From 2e65fe4fb52a67661fe57f1576f8f490da4f8eb9 Mon Sep 17 00:00:00 2001 From: Godzil Date: Sun, 25 Feb 2018 13:18:38 +0000 Subject: [PATCH] Force focus on the window (was needing to deactivate/reactivate the window for the focus to work) --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 560abda..281166f 100644 --- a/main.py +++ b/main.py @@ -43,7 +43,8 @@ class WOWFileViewer: tickinterval = self.layer_count/10 self.layer_select = tk.Scale(master, from_=1, to=self.layer_count, command=self.sliderUpdate, orient=tk.VERTICAL, - resolution=1, length=400, tickinterval=tickinterval) + resolution=-1, length=400, tickinterval=tickinterval, + takefocus=1) self.layer_select.grid(row=2, column=4) self.thick_var = tk.StringVar() @@ -91,6 +92,8 @@ class WOWFileViewer: self.close_button2 = tk.Button(master, text=" Exit ", command=master.quit) self.close_button2.grid(row=6, column=4) + self.layer_select.focus_force() + def sliderUpdate(self, pos): self.layerChange(int(pos)) @@ -129,6 +132,7 @@ def main(): wowfile = wow.WowFile(filename) lbl = None my_gui = WOWFileViewer(root, wowfile) + root.focus_force() root.mainloop()