[issue46179] Delete selected item generate "<>" event or not in different version of tkinter or Python
New submission from Jason Yang : In python(3.8.10)/tkinter(8.6.9), it won't generate "<>" event if we delete selected item of ttk.Treeview, but it will for python(3.9.9/3.10.1)/tkinter(8.6.12). Check it just by clicking 'Delete Item 1' button in following demo code ```python import sys from random import randint from datetime import datetime import tkinter as tk from tkinter import ttk def button_callback(): button.configure(state='disabled') treeview.delete(1) def treeview_callback(event): print(datetime.now().strftime("%H:%M:%S"), "Treeview selection changed !") print(f"Python version : {sys.version.split(' ')[0]}") print(f"tkinter version: {tk.Tcl().eval('info patchlevel')}") columns = ('President', 'Birthday') data = [ ('Ronald Reagan', 'February 6'), ('Abraham Lincoln', 'February 12'), ('George Washington', 'February 22'), ('Andrew Jackson', 'March 15'), ('Thomas Jefferson', 'April 13'), ] root = tk.Tk() treeview = ttk.Treeview(root, columns=columns, height=5, show='headings') treeview.pack() for column in columns: treeview.heading(column, text=column) treeview.column(column, width=150) for i, row in enumerate(data): treeview.insert('', i, iid=i, text=str(i), values=row) treeview.selection_set(1) button = tk.Button(root, text='Delete Item 1', command=button_callback) button.pack() treeview.bind("<>", treeview_callback) root.mainloop() ``` ```python d:\>python test3.py Python version : 3.8.10 tkinter version: 8.6.9 17:57:43 Treeview selection changed ! d:\>python test3.py Python version : 3.9.9 tkinter version: 8.6.12 17:58:10 Treeview selection changed ! 17:58:11 Treeview selection changed ! d:\>python test3.py Python version : 3.10.1 tkinter version: 8.6.12 18:01:10 Treeview selection changed ! 18:01:12 Treeview selection changed ! ``` -- components: Tkinter messages: 409185 nosy: Jason990420 priority: normal severity: normal status: open title: Delete selected item generate "<>" event or not in different version of tkinter or Python type: behavior versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46179> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed
New submission from Jason Yang : Button no response when clicked if mouse move into tooltip and tooltip destroyed for Python 3.9.9/3.10.1 and tkinter 8.6.12 You can check it by moving mouse into button, then move to tooltip after it shown, then click button and you won't get response for button clicked, but "Leave". It is OK for lower version of Python/tkinter. ```python import sys from datetime import datetime import tkinter as tk class Tooltip(object): """ create a tooltip for a given widget """ def __init__(self, widget, text='widget info'): self.waittime = 500 # miliseconds self.widget = widget self.text = text self.widget.bind("", self.enter) self.widget.bind("", self.leave) self.widget.bind("", self.leave) self.id = None self.top = None def enter(self, event=None): print(now(), "Enter") self.schedule() def leave(self, event=None): print(now(), "Leave") self.unschedule() self.hidetip() def schedule(self): self.unschedule() self.id = self.widget.after(self.waittime, self.showtip) def unschedule(self): id = self.id self.id = None if id: self.widget.after_cancel(id) def showtip(self, event=None): x = y = 0 x, y, cx, cy = self.widget.bbox("insert") x += self.widget.winfo_rootx() + self.widget.winfo_width()//2 y += self.widget.winfo_rooty() + self.widget.winfo_height()//2 self.top = tk.Toplevel(self.widget) self.top.wm_overrideredirect(True) self.top.wm_geometry("+%d+%d" % (x, y)) label = tk.Label(self.top, text=self.text, bd=1, font=font, relief='solid') label.pack(ipadx=1) def hidetip(self): top = self.top self.top = None if top: top.destroy() def now(): return datetime.now().strftime("%H:%M:%S") print(f"Python version : {sys.version.split(' ')[0]}") print(f"tkinter version: {tk.Tcl().eval('info patchlevel')}") font = ("Courier New", 40) root = tk.Tk() button = tk.Button(root, text="button", font=font, command=lambda:print(now(), 'Button clicked')) button.pack(padx=10, pady=5) tooltip = Tooltip(button, 'This is button 1') root.mainloop() ``` ```python d:\>python test.py Python version : 3.10.1 tkinter version: 8.6.12 18:21:52 Enter (Mouse to button) 18:21:54 Leave (mouse to tooltip) 18:21:55 Leave (button clicked get no response) 18:21:57 Leave (button clicked get no response) 18:21:58 Leave (button clicked get no response) d:\>python test.py Python version : 3.9.9 tkinter version: 8.6.12 18:22:51 Enter (Mouse to button) 18:22:54 Leave (mouse to tooltip) 18:22:55 Leave (button clicked get no response) 18:22:56 Leave (button clicked get no response) 18:22:57 Leave (button clicked get no response) d:\>python test.py Python version : 3.8.10 tkinter version: 8.6.9 18:23:22 Enter (Mouse to button) 18:23:23 Leave (mouse to tooltip) 18:23:23 Enter (mouse stay, and it will repeat `Enter and Leave` again and again) 18:23:24 Leave ... 18:23:28 Enter 18:23:28 Leave 18:23:28 Button clicked (button clicked get response) 18:23:31 Leave 18:23:31 Button clicked (button clicked get response) 18:23:32 Leave ``` Platform - WIN10 -- components: Tkinter messages: 409188 nosy: Jason990420 priority: normal severity: normal status: open title: Button clicked failed when mouse hover tooltip and tooltip destroyed type: crash versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46180> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46179] Delete selected item generate "<>" event or not in different version of tkinter or Python
Jason Yang added the comment: >From https://core.tcl-lang.org/tk/reportlist, I found the same issue ttk::treeview <> event bug https://core.tcl-lang.org/tk/tktview?name=2a6c62afd9 It is an old bug from 2014 anf not fixed, and now it fixed. OK, no more question about it. Thank you for your information. B.R., Jason Yng -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46179> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46180] Button clicked failed when mouse hover tooltip and tooltip destroyed
Jason Yang added the comment: The platform is WIN10 which shown at last line in first message. I don't have other platforms to test if ok or not. -- ___ Python tracker <https://bugs.python.org/issue46180> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46803] Item not shown when using mouse wheel to scroll for Listbox/Combobox
New submission from Jason Yang : When scrolled items by mouse wheel in tk.Listbox/ttk.Combobox, some items not shown. Is it a bug ? or I did something wrong ? In following case, 'Wednesday' will not shown when scroll mouse wheel at - tk.Listbox or vertical scrollbar of tk.Listbox, or - listbox of ttk.Combo ```python from tkinter import * from tkinter import ttk font = ('Courier New', 24) lst = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') root = Tk() frame1 = Frame(root) frame1.pack(side=LEFT) vsb1 = Scrollbar(frame1, orient='v') vsb1.pack(side=RIGHT, fill='y') var = StringVar() var.set(lst) listbox = Listbox(frame1, width=10, height=3, listvariable=var, font=font, yscrollcommand=vsb1.set) listbox.pack(side=LEFT) vsb1.configure(command=listbox.yview) frame2 = Frame(root) frame2.pack(side=LEFT, fill='y') combobox = ttk.Combobox(frame2, values=lst, width=10, height=3, font=font) combobox.pack() root.mainloop() ``` Platform: WIN10 -- components: Tkinter files: PeS9r.png messages: 413564 nosy: Jason990420 priority: normal severity: normal status: open title: Item not shown when using mouse wheel to scroll for Listbox/Combobox type: behavior versions: Python 3.8, Python 3.9 Added file: https://bugs.python.org/file50634/PeS9r.png ___ Python tracker <https://bugs.python.org/issue46803> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com