[New-bugs-announce] [issue31483] ButtonPress event not firing until button release Python 3.6.1
Mike McDonnal
report at bugs.python.org
Fri Sep 15 09:17:31 EDT 2017
New submission from Mike McDonnal:
On my version of python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]
As well as on 3.6.2 for some other users I have spoken to there seams to be an issue with the event for pressing the mouse button down.
The event <Button-1> or <ButtonPress-1> do not fire when the mouse button is pressed but rather when the mouse button is released.
The following example code works fine on 2.7 but the button event is not working properly on at lease my version and 3.6.2
import Tkinter as tk
import ttk
app = tk.Tk()
t = ttk.Treeview(app)
t.pack(side="top",fill="both",expand=1)
scrolling = False
xscroll = tk.Scrollbar(app,command=t.xview,orient="horizontal")
t.configure(xscrollcommand=xscroll.set)
xscroll.pack(side="top",fill="x")
def scrolling_active(arrow, *args):
global scrolling
if scrolling == True:
if arrow == "arrow1":
t.xview('scroll', -5, 'units')
if arrow == "arrow2":
t.xview('scroll', 5, 'units')
app.after(5, lambda a = arrow: scrolling_active(a))
def start_scrolling(event):
global scrolling
scrolling = True
scrolling_active(xscroll.identify(event.x, event.y))
def stop_scrolling(event):
global scrolling
scrolling = False
xscroll.bind("<Button-1>", start_scrolling)
xscroll.bind('<ButtonRelease-1>', stop_scrolling)
tcols = ["header " + str(i)
for i in range(50)]
t.config(columns=tcols)
for h in tcols:
t.heading(h,text=h)
for i in range(5):
t.insert("","end",
text = "item" + str(i),
values = ["value" + str(x) for x in range(49)])
app.geometry("{}x{}".format(400, 300))
app.mainloop()
----------
components: Windows
messages: 302251
nosy: BaconTech, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: ButtonPress event not firing until button release Python 3.6.1
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31483>
_______________________________________
More information about the New-bugs-announce
mailing list