From Vasilis.Vlachoudis at cern.ch Thu May 9 03:58:42 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 9 May 2019 07:58:42 +0000 Subject: [Tkinter-discuss] Button event calls Leave/Enter Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> Hi all, I've just realized that the mouse click event generates as well a followed by event before. With the program below, if one clicks in the frame you get the messages printed Leave event Enter event Button1 pressed Which I don't understand the reasoning behind. However it generates a problem to my application since I have some actions that are binded with the Leave event and when the button1 handler is called the program has already altered some structures. Is there a way forbit the calls to Leave/Enter before the Button1? Many thanks in advance Vasilis import tkinter as tk def enter(event): print("Enter event") def leave(event): print("Leave event") def button1(event): print("Button1 pressed") root = tk.Tk() frame = tk.Frame(root, bg="Yellow", takefocus=False, width=600, height=400) frame.pack(fill=tk.BOTH, expand=tk.YES) frame.bind("", enter) frame.bind("", leave) frame.bind("", button1) root.mainloop() -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Fri May 10 18:57:14 2019 From: klappnase at web.de (Michael Lange) Date: Sat, 11 May 2019 00:57:14 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> Message-ID: <20190511005714.0b11d128aa2ed21dd0f02591@web.de> Hi, On Thu, 9 May 2019 07:58:42 +0000 Vasilis Vlachoudis wrote: > Hi all, > > I've just realized that the mouse click event generates as > well a followed by event before. what system are you using and which version of Tcl/Tk? I cannot reproduce that behavior here (Debian, Tk 8.6.6). Regards Michael > With the program below, if one clicks in the frame > you get the messages printed > Leave event > Enter event > Button1 pressed > Which I don't understand the reasoning behind. However it generates > a problem to my application since I have some actions that are binded > with the Leave event and when the button1 handler is called the program > has already altered some structures. > Is there a way forbit the calls to Leave/Enter before the Button1? > > Many thanks in advance > Vasilis > > import tkinter as tk > def enter(event): print("Enter event") > def leave(event): print("Leave event") > def button1(event): print("Button1 pressed") > > root = tk.Tk() > frame = tk.Frame(root, bg="Yellow", > takefocus=False, > width=600, height=400) > frame.pack(fill=tk.BOTH, expand=tk.YES) > frame.bind("", enter) > frame.bind("", leave) > frame.bind("", button1) > root.mainloop() > .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Virtue is a relative term. -- Spock, "Friday's Child", stardate 3499.1 From Vasilis.Vlachoudis at cern.ch Sun May 12 13:49:44 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Sun, 12 May 2019 17:49:44 +0000 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <20190511005714.0b11d128aa2ed21dd0f02591@web.de> References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch>, <20190511005714.0b11d128aa2ed21dd0f02591@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> Hi Michael, I am using Ubuntu 19.04 with python 3.7 and tk 8.6.9+1 Vasilis Vlachoudis Dep EN, CERN CH-1211 GENEVA 23 SWITZERLAND Phone: +41-22 767 9851 GSM: +41-75 411 4378 ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Saturday, May 11, 2019 00:57 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter Hi, On Thu, 9 May 2019 07:58:42 +0000 Vasilis Vlachoudis wrote: > Hi all, > > I've just realized that the mouse click event generates as > well a followed by event before. what system are you using and which version of Tcl/Tk? I cannot reproduce that behavior here (Debian, Tk 8.6.6). Regards Michael > With the program below, if one clicks in the frame > you get the messages printed > Leave event > Enter event > Button1 pressed > Which I don't understand the reasoning behind. However it generates > a problem to my application since I have some actions that are binded > with the Leave event and when the button1 handler is called the program > has already altered some structures. > Is there a way forbit the calls to Leave/Enter before the Button1? > > Many thanks in advance > Vasilis > > import tkinter as tk > def enter(event): print("Enter event") > def leave(event): print("Leave event") > def button1(event): print("Button1 pressed") > > root = tk.Tk() > frame = tk.Frame(root, bg="Yellow", > takefocus=False, > width=600, height=400) > frame.pack(fill=tk.BOTH, expand=tk.YES) > frame.bind("", enter) > frame.bind("", leave) > frame.bind("", button1) > root.mainloop() > .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Virtue is a relative term. -- Spock, "Friday's Child", stardate 3499.1 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From Vasilis.Vlachoudis at cern.ch Sun May 12 14:23:01 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Sun, 12 May 2019 18:23:01 +0000 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch>, <20190511005714.0b11d128aa2ed21dd0f02591@web.de>, <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> xubuntu to be more precise ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Vasilis Vlachoudis [Vasilis.Vlachoudis at cern.ch] Sent: Sunday, May 12, 2019 19:49 To: Michael Lange; tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter Hi Michael, I am using Ubuntu 19.04 with python 3.7 and tk 8.6.9+1 Vasilis Vlachoudis Dep EN, CERN CH-1211 GENEVA 23 SWITZERLAND Phone: +41-22 767 9851 GSM: +41-75 411 4378 ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Saturday, May 11, 2019 00:57 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter Hi, On Thu, 9 May 2019 07:58:42 +0000 Vasilis Vlachoudis wrote: > Hi all, > > I've just realized that the mouse click event generates as > well a followed by event before. what system are you using and which version of Tcl/Tk? I cannot reproduce that behavior here (Debian, Tk 8.6.6). Regards Michael > With the program below, if one clicks in the frame > you get the messages printed > Leave event > Enter event > Button1 pressed > Which I don't understand the reasoning behind. However it generates > a problem to my application since I have some actions that are binded > with the Leave event and when the button1 handler is called the program > has already altered some structures. > Is there a way forbit the calls to Leave/Enter before the Button1? > > Many thanks in advance > Vasilis > > import tkinter as tk > def enter(event): print("Enter event") > def leave(event): print("Leave event") > def button1(event): print("Button1 pressed") > > root = tk.Tk() > frame = tk.Frame(root, bg="Yellow", > takefocus=False, > width=600, height=400) > frame.pack(fill=tk.BOTH, expand=tk.YES) > frame.bind("", enter) > frame.bind("", leave) > frame.bind("", button1) > root.mainloop() > .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Virtue is a relative term. -- Spock, "Friday's Child", stardate 3499.1 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From grubert at users.sourceforge.net Sun May 12 15:54:19 2019 From: grubert at users.sourceforge.net (engelbert gruber) Date: Sun, 12 May 2019 21:54:19 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> <20190511005714.0b11d128aa2ed21dd0f02591@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> Message-ID: not reproducable on macos python3.7.3 tkinter8.6.8 On Sun, 12 May 2019 at 20:23, Vasilis Vlachoudis wrote: > xubuntu to be more precise > > > > ________________________________________ > From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis= > cern.ch at python.org] on behalf of Vasilis Vlachoudis [ > Vasilis.Vlachoudis at cern.ch] > Sent: Sunday, May 12, 2019 19:49 > To: Michael Lange; tkinter-discuss at python.org > Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter > > Hi Michael, > > I am using Ubuntu 19.04 > with python 3.7 and tk 8.6.9+1 > > Vasilis Vlachoudis > Dep EN, CERN > CH-1211 GENEVA 23 > SWITZERLAND > > Phone: +41-22 767 9851 > GSM: +41-75 411 4378 > > > ________________________________________ > From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis= > cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] > Sent: Saturday, May 11, 2019 00:57 > To: tkinter-discuss at python.org > Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter > > Hi, > > On Thu, 9 May 2019 07:58:42 +0000 > Vasilis Vlachoudis wrote: > > > Hi all, > > > > I've just realized that the mouse click event generates as > > well a followed by event before. > > what system are you using and which version of Tcl/Tk? > I cannot reproduce that behavior here (Debian, Tk 8.6.6). > > Regards > > Michael > > > With the program below, if one clicks in the frame > > you get the messages printed > > Leave event > > Enter event > > Button1 pressed > > Which I don't understand the reasoning behind. However it generates > > a problem to my application since I have some actions that are binded > > with the Leave event and when the button1 handler is called the program > > has already altered some structures. > > Is there a way forbit the calls to Leave/Enter before the Button1? > > > > Many thanks in advance > > Vasilis > > > > import tkinter as tk > > def enter(event): print("Enter event") > > def leave(event): print("Leave event") > > def button1(event): print("Button1 pressed") > > > > root = tk.Tk() > > frame = tk.Frame(root, bg="Yellow", > > takefocus=False, > > width=600, height=400) > > frame.pack(fill=tk.BOTH, expand=tk.YES) > > frame.bind("", enter) > > frame.bind("", leave) > > frame.bind("", button1) > > root.mainloop() > > > > > > .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. > > Virtue is a relative term. > -- Spock, "Friday's Child", stardate 3499.1 > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > https://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at tartan.co.za Mon May 13 02:19:58 2019 From: paul at tartan.co.za (Paul Malherbe) Date: Mon, 13 May 2019 08:19:58 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> <20190511005714.0b11d128aa2ed21dd0f02591@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> Message-ID: <278e66a9-4b9c-aeea-3545-b29d72767d30@tartan.co.za> An HTML attachment was scrubbed... URL: From klappnase at web.de Mon May 13 04:23:02 2019 From: klappnase at web.de (Michael Lange) Date: Mon, 13 May 2019 10:23:02 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <278e66a9-4b9c-aeea-3545-b29d72767d30@tartan.co.za> References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> <20190511005714.0b11d128aa2ed21dd0f02591@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> <278e66a9-4b9c-aeea-3545-b29d72767d30@tartan.co.za> Message-ID: <20190513102302.e90f2cadbfffb9de24baa6fd@web.de> Hi, On Mon, 13 May 2019 08:19:58 +0200 Paul Malherbe wrote: > Same happens on Ubuntu 18.04 with python 2.7.15/3.6.7 and tcl/tk 8.6.8 very strange. Maybe an issue with the WM? Do you also use Xfce? Did you (or Vasilis) try a different WM? Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "What happened to the crewman?" "The M-5 computer needed a new power source, the crewman merely got in the way." -- Kirk and Dr. Richard Daystrom, "The Ultimate Computer", stardate 4731.3. From paul at tartan.co.za Mon May 13 04:27:12 2019 From: paul at tartan.co.za (Paul Malherbe) Date: Mon, 13 May 2019 10:27:12 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <20190513102302.e90f2cadbfffb9de24baa6fd@web.de> References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> <20190511005714.0b11d128aa2ed21dd0f02591@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> <278e66a9-4b9c-aeea-3545-b29d72767d30@tartan.co.za> <20190513102302.e90f2cadbfffb9de24baa6fd@web.de> Message-ID: An HTML attachment was scrubbed... URL: From klappnase at web.de Mon May 13 13:27:39 2019 From: klappnase at web.de (Michael Lange) Date: Mon, 13 May 2019 19:27:39 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: References: <0BC70B5D93E054469872FFD0FE07220E0288FA7BB1@CERNXCHG53.cern.ch> <20190511005714.0b11d128aa2ed21dd0f02591@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAB5FE@CERNXCHG53.cern.ch> <0BC70B5D93E054469872FFD0FE07220E0288FAB630@CERNXCHG53.cern.ch> <278e66a9-4b9c-aeea-3545-b29d72767d30@tartan.co.za> <20190513102302.e90f2cadbfffb9de24baa6fd@web.de> Message-ID: <20190513192739.b5bfb2fdeee81dc099f3394b@web.de> On Mon, 13 May 2019 10:27:12 +0200 Paul Malherbe wrote: > Yes, definitely seems to be an xfce thing. Tried with gnome and worked > fine. Good to know that. Unfortunately this does not help much with the OP's question :-( Maybe some property of the event could be checked, if there is a difference betwen a "real" and a "fake" or event. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Sometimes a feeling is all we humans have to go on. -- Kirk, "A Taste of Armageddon", stardate 3193.9 From mkiever at web.de Mon May 13 13:32:10 2019 From: mkiever at web.de (mkiever at web.de) Date: Mon, 13 May 2019 17:32:10 -0000 Subject: [Tkinter-discuss] =?utf-8?q?Button_event_calls_Leave/Enter?= Message-ID: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> Hello, >very strange. Maybe an issue with the WM? Do you also use Xfce? Did you >(or Vasilis) try a different WM? To add some data about used WMs, not reproducible on: Python 3.5.3 (some small tkinter patches) tcl/tk 8.6.6 debian stretch ctwm Regards, Matthias ------------------------------------------------------------------------------ Matthias Kievernagel mkiever/at/web/dot/de ------------------------------------------------------------------------------ From klappnase at web.de Mon May 13 14:43:41 2019 From: klappnase at web.de (Michael Lange) Date: Mon, 13 May 2019 20:43:41 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> References: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> Message-ID: <20190513204341.53f0d1d73654b02c0b79958e@web.de> Hi, On Mon, 13 May 2019 17:32:10 -0000 mkiever at web.de wrote: > Hello, > > >very strange. Maybe an issue with the WM? Do you also use Xfce? Did you > >(or Vasilis) try a different WM? > > To add some data about used WMs, not reproducible on: > Python 3.5.3 (some small tkinter patches) > tcl/tk 8.6.6 > debian stretch > ctwm oh, I forgot to mention earlier, not reproducible here on Debian Stretch with IceWM. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Power is danger. -- The Centurion, "Balance of Terror", stardate 1709.2 From Vasilis.Vlachoudis at cern.ch Tue May 14 09:53:54 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Tue, 14 May 2019 13:53:54 +0000 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> References: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FACC2A@CERNXCHG53.cern.ch> Thanks all for your replies. I've saw that there is a difference in the event.state, but I cannot find any information on what each bit represents. V. ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of mkiever at web.de [mkiever at web.de] Sent: Monday, May 13, 2019 19:32 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter Hello, >very strange. Maybe an issue with the WM? Do you also use Xfce? Did you >(or Vasilis) try a different WM? To add some data about used WMs, not reproducible on: Python 3.5.3 (some small tkinter patches) tcl/tk 8.6.6 debian stretch ctwm Regards, Matthias ------------------------------------------------------------------------------ Matthias Kievernagel mkiever/at/web/dot/de ------------------------------------------------------------------------------ _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Tue May 14 12:26:37 2019 From: klappnase at web.de (Michael Lange) Date: Tue, 14 May 2019 18:26:37 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FACC2A@CERNXCHG53.cern.ch> References: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> <0BC70B5D93E054469872FFD0FE07220E0288FACC2A@CERNXCHG53.cern.ch> Message-ID: <20190514182637.7c5043e6d7bd2c3cb86171d7@web.de> Hi, On Tue, 14 May 2019 13:53:54 +0000 Vasilis Vlachoudis wrote: > Thanks all for your replies. > I've saw that there is a difference in the event.state, but I cannot > find any information on what each bit represents. > I modified your leave() callback using the values given at: https://infohost.nmt.edu/tcc/help/pubs/tkinter/web/event-handlers.html into: def leave(event): s = event.state b1 = (s & 0x0100) != 0 if b1: print('leave event with Button 1 pressed', 'event.state:', s) else: print('regular leave event', 'event.state:', s) which actually seems to do the trick (btw., same behavior here with xfce, so the exact Tk version apparently doesn't matter). However, there still seems to be no way to tell if it is an actual Leave event (i.e. mouse pointer dragged out of the window) while Button1 is pressed or one of those fake-Xfce-Leave events. The same "fake" events occur here also with Button2 and Button3, so there might be more event.state values to consider. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. On my planet, to rest is to rest -- to cease using energy. To me, it is quite illogical to run up and down on green grass, using energy, instead of saving it. -- Spock, "Shore Leave", stardate 3025.2 From Vasilis.Vlachoudis at cern.ch Wed May 15 01:50:24 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 15 May 2019 05:50:24 +0000 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <20190514182637.7c5043e6d7bd2c3cb86171d7@web.de> References: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> <0BC70B5D93E054469872FFD0FE07220E0288FACC2A@CERNXCHG53.cern.ch>, <20190514182637.7c5043e6d7bd2c3cb86171d7@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FAD126@CERNXCHG53.cern.ch> Thanks. I did what you proposed if event.state>=256: # then mouse event, ignore... Maybe a bug report should be opened in XFCE? In the X11 events it states that Enter/LeaveNotify is only due to the cursor movement entering/exiting a window, not a mouse press. Vasilis ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Tuesday, May 14, 2019 18:26 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Button event calls Leave/Enter Hi, On Tue, 14 May 2019 13:53:54 +0000 Vasilis Vlachoudis wrote: > Thanks all for your replies. > I've saw that there is a difference in the event.state, but I cannot > find any information on what each bit represents. > I modified your leave() callback using the values given at: https://infohost.nmt.edu/tcc/help/pubs/tkinter/web/event-handlers.html into: def leave(event): s = event.state b1 = (s & 0x0100) != 0 if b1: print('leave event with Button 1 pressed', 'event.state:', s) else: print('regular leave event', 'event.state:', s) which actually seems to do the trick (btw., same behavior here with xfce, so the exact Tk version apparently doesn't matter). However, there still seems to be no way to tell if it is an actual Leave event (i.e. mouse pointer dragged out of the window) while Button1 is pressed or one of those fake-Xfce-Leave events. The same "fake" events occur here also with Button2 and Button3, so there might be more event.state values to consider. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. On my planet, to rest is to rest -- to cease using energy. To me, it is quite illogical to run up and down on green grass, using energy, instead of saving it. -- Spock, "Shore Leave", stardate 3025.2 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Wed May 15 05:18:35 2019 From: klappnase at web.de (Michael Lange) Date: Wed, 15 May 2019 11:18:35 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FAD126@CERNXCHG53.cern.ch> References: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> <0BC70B5D93E054469872FFD0FE07220E0288FACC2A@CERNXCHG53.cern.ch> <20190514182637.7c5043e6d7bd2c3cb86171d7@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAD126@CERNXCHG53.cern.ch> Message-ID: <20190515111835.e5eb51fe8082333ec7b77e84@web.de> Hi, On Wed, 15 May 2019 05:50:24 +0000 Vasilis Vlachoudis wrote: > Thanks. > I did what you proposed > if event.state>=256: # then mouse event, ignore... > > Maybe a bug report should be opened in XFCE? In the X11 events it states > that Enter/LeaveNotify is only due to the cursor movement > entering/exiting a window, not a mouse press. > I noticed when trying on Debian Sid that LXDE appears also to be affected (same behavior as with Xfce). I tried then to ask on debian-user first if someone knows which package the bug should be reported to (https://lists.debian.org/debian-user/2019/05/msg00668.html), I guess probably some library both use. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "I think they're going to take all this money that we spend now on war and death --" "And make them spend it on life." -- Edith Keeler and Kirk, "The City on the Edge of Forever", stardate unknown. From klappnase at web.de Thu May 16 18:26:40 2019 From: klappnase at web.de (Michael Lange) Date: Fri, 17 May 2019 00:26:40 +0200 Subject: [Tkinter-discuss] Button event calls Leave/Enter In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FAD126@CERNXCHG53.cern.ch> References: <0M7snk-1gUzUQ1SIC-00vRJ1@smtp.web.de> <0BC70B5D93E054469872FFD0FE07220E0288FACC2A@CERNXCHG53.cern.ch> <20190514182637.7c5043e6d7bd2c3cb86171d7@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FAD126@CERNXCHG53.cern.ch> Message-ID: <20190517002640.1b0ce114ca8e9bab5ea4af32@web.de> Hi, On Wed, 15 May 2019 05:50:24 +0000 Vasilis Vlachoudis wrote: > Thanks. > I did what you proposed > if event.state>=256: # then mouse event, ignore... > > Maybe a bug report should be opened in XFCE? In the X11 events it states > that Enter/LeaveNotify is only due to the cursor movement > entering/exiting a window, not a mouse press. > fyi, I now filed a bug report here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929090 Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. You speak of courage. Obviously you do not know the difference between courage and foolhardiness. Always it is the brave ones who die, the soldiers. -- Kor, the Klingon Commander, "Errand of Mercy", stardate 3201.7 From Vasilis.Vlachoudis at cern.ch Wed May 29 09:01:16 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 29 May 2019 13:01:16 +0000 Subject: [Tkinter-discuss] ttk.Notebook: autohide Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch> Hi all I am using the ttk.Notebook for an editor like application and I want to implement something like autohide functionality for the tabheadings when there is only one tab, and to reappear when there are more than one. Is there some function to set the height to 0 for the headings of "pack_forget" equivalent in the style? Thanks in advance Vasilis -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Wed May 29 17:56:50 2019 From: klappnase at web.de (Michael Lange) Date: Wed, 29 May 2019 23:56:50 +0200 Subject: [Tkinter-discuss] ttk.Notebook: autohide In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch> Message-ID: <20190529235650.b1e1217391893b3b17e67e7d@web.de> Hi, On Wed, 29 May 2019 13:01:16 +0000 Vasilis Vlachoudis wrote: > Hi all > > I am using the ttk.Notebook for an editor like application and I want > to implement something like autohide functionality for the tabheadings > when there is only one tab, and to reappear when there are more than > one. > > Is there some function to set the height to 0 for the headings of > "pack_forget" equivalent in the style? it seems you can show or hide the tabs with something like: s=ttk.Style() # store default layout options tablayout = s.layout('TNotebook.Tab') # hide tabs s.layout('TNotebook.Tab', []) # show tabs again s.layout('TNotebook.Tab',tablayout) Idea borrowed from: https://stackoverflow.com/questions/26923010/how-do-i-hide-the-entire-tab-bar-in-a-tkinter-ttk-notebook-widget Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. There is an old custom among my people. When a woman saves a man's life, he is grateful. -- Nona, the Kanuto witch woman, "A Private Little War", stardate 4211.8. From Vasilis.Vlachoudis at cern.ch Thu May 30 15:49:33 2019 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 30 May 2019 19:49:33 +0000 Subject: [Tkinter-discuss] ttk.Notebook: autohide In-Reply-To: <20190529235650.b1e1217391893b3b17e67e7d@web.de> References: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch>, <20190529235650.b1e1217391893b3b17e67e7d@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E0288FDAB3E@CERNXCHG51.cern.ch> Many thanks Michael. The recipe works the tab bar disappears (and reappears), but the space of the tabs is not reclaimed. the child-window is not resized to get the extra space. If I resize the toplevel window with the mouse then it works. Is there a way to force the layout manager to recalculate all widgets? Best regards Vasilis ________________________________________ From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: Wednesday, May 29, 2019 23:56 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] ttk.Notebook: autohide Hi, On Wed, 29 May 2019 13:01:16 +0000 Vasilis Vlachoudis wrote: > Hi all > > I am using the ttk.Notebook for an editor like application and I want > to implement something like autohide functionality for the tabheadings > when there is only one tab, and to reappear when there are more than > one. > > Is there some function to set the height to 0 for the headings of > "pack_forget" equivalent in the style? it seems you can show or hide the tabs with something like: s=ttk.Style() # store default layout options tablayout = s.layout('TNotebook.Tab') # hide tabs s.layout('TNotebook.Tab', []) # show tabs again s.layout('TNotebook.Tab',tablayout) Idea borrowed from: https://stackoverflow.com/questions/26923010/how-do-i-hide-the-entire-tab-bar-in-a-tkinter-ttk-notebook-widget Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. There is an old custom among my people. When a woman saves a man's life, he is grateful. -- Nona, the Kanuto witch woman, "A Private Little War", stardate 4211.8. _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org https://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Thu May 30 18:33:22 2019 From: klappnase at web.de (Michael Lange) Date: Fri, 31 May 2019 00:33:22 +0200 Subject: [Tkinter-discuss] ttk.Notebook: autohide In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E0288FDAB3E@CERNXCHG51.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E0288FD914D@CERNXCHG51.cern.ch> <20190529235650.b1e1217391893b3b17e67e7d@web.de> <0BC70B5D93E054469872FFD0FE07220E0288FDAB3E@CERNXCHG51.cern.ch> Message-ID: <20190531003322.22a3008bed28a011b6a3f39e@web.de> Hi, On Thu, 30 May 2019 19:49:33 +0000 Vasilis Vlachoudis wrote: > Many thanks Michael. > The recipe works the tab bar disappears (and reappears), but the space > of the tabs is not reclaimed. the child-window is not resized to get > the extra space. If I resize the toplevel window with the mouse then it > works. oh, I see. This "works" also vice versa here, the tab only reappears after resizing the window with the mouse. Too bad, looks like a bug to me. > > Is there a way to force the layout manager to recalculate all widgets? > I am not sure how to do this, except with an ugly hack like: def hidetabs(ev): s.layout('TNotebook.Tab', []) nb.pack(expand=0) nb.update_idletasks() nb.pack(fill='both', expand=1) But that looks rather stupid and besides causes an annoying "flickering" effect. The flickering seems to be a bit better with a "minimally invasive" re-packing, as in def hidetabs(ev): s.layout('TNotebook.Tab', []) info = nb.pack_info() px = info['padx'] del info['padx'] nb.pack(padx=px + 1, **info) nb.update_idletasks() nb.pack(padx=px, **info) but this looks somehow even more stupid. But maybe I just miss something obvious? Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "Can you imagine how life could be improved if we could do away with jealousy, greed, hate ..." "It can also be improved by eliminating love, tenderness, sentiment -- the other side of the coin" -- Dr. Roger Corby and Kirk, "What are Little Girls Made Of?", stardate 2712.4