Added toggles for sounds
This commit is contained in:
parent
613a4b36c7
commit
a56dd547b9
1 changed files with 13 additions and 2 deletions
15
GUI.py
15
GUI.py
|
@ -68,7 +68,8 @@ class Options_Window:
|
||||||
self.textures_object = Textures()
|
self.textures_object = Textures()
|
||||||
self.options = {
|
self.options = {
|
||||||
"Difficulty": 120,
|
"Difficulty": 120,
|
||||||
"Textures": self.textures_object
|
"Textures": self.textures_object,
|
||||||
|
"Sounds": True
|
||||||
}
|
}
|
||||||
|
|
||||||
def display(self, master):
|
def display(self, master):
|
||||||
|
@ -102,15 +103,25 @@ class Options_Window:
|
||||||
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)
|
||||||
|
|
||||||
|
Frame(self.master,height=23).pack()
|
||||||
|
|
||||||
|
self.using_sounds = IntVar()
|
||||||
|
self.using_sounds.set(self.options["Sounds"])
|
||||||
|
self.sounds_check = Checkbutton(self.master, text="Enable Sound Effects", command=self.update_sounds, variable=self.using_sounds)
|
||||||
|
self.sounds_check.pack(ipadx=PADDING_BUTTON/3, padx=PADDING_BUTTON)
|
||||||
|
|
||||||
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)
|
||||||
logging.info("Options menu created.")
|
logging.info("Options menu created.")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.options["Textures"].pack = self.texture_select.get(ACTIVE) if self.texture_select.get(ACTIVE) != "" else "default" # Because it has no changed event
|
self.options["Textures"].pack = self.texture_select.get(ACTIVE) if self.texture_select.get(ACTIVE) != "" else "default" # Because it has no changed event
|
||||||
logging.info("Selected Texture Pack: {}".format(self.options["Textures"].pack))
|
logging.info("Selected Texture Pack: {}".format(self.options["Textures"].pack))
|
||||||
self.master.destroy()
|
self.master.destroy()
|
||||||
|
|
||||||
|
def update_sounds(self):
|
||||||
|
self.options["Sounds"] = self.using_sounds.get()
|
||||||
|
|
||||||
def update_difficulty(self, event):
|
def update_difficulty(self, event):
|
||||||
self.options["Difficulty"] = int(self.difficulty_scale.get())
|
self.options["Difficulty"] = int(self.difficulty_scale.get())
|
||||||
self.difficulty_title["text"] = "Current Difficulty: {}".format(self.options["Difficulty"])
|
self.difficulty_title["text"] = "Current Difficulty: {}".format(self.options["Difficulty"])
|
||||||
|
|
Reference in a new issue