1
Fork 0

Updated options, and added about button

This commit is contained in:
Jake Howard 2015-05-12 14:59:41 +01:00
parent d005fd5a52
commit f7de3262d9

29
GUI.py
View file

@ -1,6 +1,7 @@
from tkinter import * from tkinter import *
from tkinter.ttk import * from tkinter.ttk import *
import logging import logging
from os import system
import game import game
from assets import Textures from assets import Textures
@ -27,6 +28,11 @@ class Main_Window:
self.options_button.pack(fill=BOTH, ipadx=PADDING_BUTTON/2, ipady=PADDING_BUTTON/2, padx=PADDING_BUTTON, pady=PADDING_BUTTON) self.options_button.pack(fill=BOTH, ipadx=PADDING_BUTTON/2, ipady=PADDING_BUTTON/2, padx=PADDING_BUTTON, pady=PADDING_BUTTON)
self.options_button.bind('<Button-1>', self.show_options) self.options_button.bind('<Button-1>', self.show_options)
self.help_button = Button(self.master, style="Menu.TButton")
self.help_button.config(text="About / Help")
self.help_button.pack(ipadx=PADDING_BUTTON/3, ipady=PADDING_BUTTON, padx=PADDING_BUTTON, pady=PADDING_BUTTON)
self.help_button.bind('<Button-1>', self.show_info)
self.exit_button = Button(self.master, style="Quit.TButton") self.exit_button = Button(self.master, style="Quit.TButton")
self.exit_button.config(text="Quit Game") self.exit_button.config(text="Quit Game")
self.exit_button.pack(ipadx=PADDING_BUTTON/3, ipady=PADDING_BUTTON, padx=PADDING_BUTTON, pady=PADDING_BUTTON) self.exit_button.pack(ipadx=PADDING_BUTTON/3, ipady=PADDING_BUTTON, padx=PADDING_BUTTON, pady=PADDING_BUTTON)
@ -47,6 +53,10 @@ class Main_Window:
self.new_window = Toplevel(self.master) self.new_window = Toplevel(self.master)
self.options_window.display(self.new_window) self.options_window.display(self.new_window)
def show_info(self, event):
logging.info("Loading About Page...")
system("https://bitbucket.org/theorangeone/space-invaders/wiki/Home")
def close(self, event): def close(self, event):
logging.critical("Closing Main Window.") logging.critical("Closing Main Window.")
self.master.destroy() self.master.destroy()
@ -69,25 +79,28 @@ class Options_Window:
self.title.pack(side="top", padx=PADDING_TITLE, pady=PADDING_TITLE/2) self.title.pack(side="top", padx=PADDING_TITLE, pady=PADDING_TITLE/2)
self.difficulty_title = Label(self.master) self.difficulty_title = Label(self.master)
self.difficulty_title.config(text="Current Difficulty: {}".format(self.options["Difficulty"]), font=("Courier New", 19)) self.difficulty_title.config(text="Current Difficulty: {}".format(self.options["Difficulty"]), font=("Courier New", 13))
self.difficulty_title.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON) self.difficulty_title.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON)
self.difficulty_scale = Scale(self.master, from_=30, to=300, orient="horizontal", command=self.update_difficulty, length=400) self.difficulty_scale = Scale(self.master, from_=5, to=500, orient="horizontal", command=self.update_difficulty, length=450)
self.difficulty_scale.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON/3) self.difficulty_scale.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON/3)
self.difficulty_scale["value"] = self.options["Difficulty"]
Frame(self.master,height=23).pack()
self.texture_title = Label(self.master) self.texture_title = Label(self.master)
self.texture_title.config(text="Select Texture Pack", font=("Courier New", 19)) self.texture_title.config(text="Select Texture Pack", font=("Courier New", 13))
self.texture_title.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON) self.texture_title.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON)
self.exit_button = Button(self.master, style="Minor.TButton") self.texture_reset = Button(self.master, style="Minor.TButton")
self.exit_button.config(text="Reset") self.texture_reset.config(text="Reset")
self.exit_button.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON/3) self.texture_reset.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON/3)
self.exit_button.bind('<Button-1>', self.reset_difficulty) self.texture_reset.bind('<Button-1>', self.reset_difficulty)
self.texture_select = Listbox(master) self.texture_select = Listbox(master)
self.texture_select.delete(0, END) self.texture_select.delete(0, END)
for directory in self.options["Textures"].list_packs(): for directory in self.options["Textures"].list_packs():
if directory == "": continue
self.texture_select.insert(END, directory) self.texture_select.insert(END, directory)
self.texture_select.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON/3) self.texture_select.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON/3)
self.reset_difficulty(None)
Style().configure("Minor.TButton", font=("Lucida", 10)) Style().configure("Minor.TButton", font=("Lucida", 10))
self.master.protocol('WM_DELETE_WINDOW', self.close) self.master.protocol('WM_DELETE_WINDOW', self.close)