Completed another major overhaul - hopefully
This commit is contained in:
parent
ac050d6627
commit
6b6cacbecd
2 changed files with 13 additions and 16 deletions
12
textmenu.py
12
textmenu.py
|
|
@ -204,6 +204,12 @@ class TextMenu:
|
|||
# Pack with fill and expand to take up available space
|
||||
self.listbox.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
|
||||
scrollbar.config(command=self.listbox.yview)
|
||||
|
||||
# Set first item as active
|
||||
if self.choices:
|
||||
self.listbox.selection_set(0)
|
||||
self.listbox.activate(0)
|
||||
self.listbox.focus_set() # This ensures the listbox has keyboard focus
|
||||
|
||||
# Create timer frame at the bottom using border_bg
|
||||
self.timer_frame = tk.Frame(main_frame, bg=self.border_bg)
|
||||
|
|
@ -232,12 +238,6 @@ class TextMenu:
|
|||
self.root.bind('<Button-4>', lambda e: self._on_mousewheel_linux(-1)) # Scroll up
|
||||
self.root.bind('<Button-5>', lambda e: self._on_mousewheel_linux(1)) # Scroll down
|
||||
|
||||
# Set first item as active
|
||||
if self.choices:
|
||||
self.listbox.selection_set(0)
|
||||
self.listbox.activate(0)
|
||||
self.listbox.focus_set() # This ensures the listbox has keyboard focus
|
||||
|
||||
def _on_mousewheel_linux(self, direction):
|
||||
"""Handle Linux mouse wheel events"""
|
||||
self._cancel_timeout()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue