From waynejwerner at gmail.com Fri Oct 1 01:18:44 2010 From: waynejwerner at gmail.com (Wayne Werner) Date: Thu, 30 Sep 2010 18:18:44 -0500 Subject: [Tkinter-discuss] Visual (8-bit!) tkinter Cheatsheets In-Reply-To: References: Message-ID: I really like those - they're quite nice! I'm going to be giving a Tkinter presentation at PyArkansas October 16, would you mind if I include these in my presentation? -Wayne On Thu, Sep 30, 2010 at 1:47 PM, Lion Kimbro wrote: > > Hi all, > > For many reasons, but mainly just for fun, I made some tkinter > documentation in pixel graphics. > > I'd like to share what I made, here it is..! > > [image: grid_layout.png][image: button.png] > > It's pretty exhausting work, making letters pixel by pixel, but I like > the results (assuming you can even see them.) > > If I receive encouragement and interesting criticism, I think I'll be > motivated to make a few more. {:)}= > I think next, I want to document row & column configuration on the Grid, > and perhaps how Images work. > > Please feel free to share these however you like. > > Take care, > Lion > > > (If the images don't go through the mail, here are two URLs to them: > http://twitpic.com/2t4n9p/full > http://twitpic.com/2t4n9q/full ) > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: grid_layout.png Type: image/png Size: 5995 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: button.png Type: image/png Size: 4287 bytes Desc: not available URL: From lionkimbro at gmail.com Fri Oct 1 01:33:19 2010 From: lionkimbro at gmail.com (Lion Kimbro) Date: Thu, 30 Sep 2010 16:33:19 -0700 Subject: [Tkinter-discuss] Visual (8-bit!) tkinter Cheatsheets In-Reply-To: References: Message-ID: Thanks Wayne! Please *do *include them; And I'd love to hear how they are received afterwards. By the time your presentation happens, I should have 1-3 more as well. If you have any special requests (any particular aspects of tkinter you'd like to see imaged,) let me know, and I'll create those first. On Thu, Sep 30, 2010 at 4:18 PM, Wayne Werner wrote: > I really like those - they're quite nice! I'm going to be giving a Tkinter > presentation at PyArkansas October 16, would you mind if I include these in > my presentation? > > -Wayne > > On Thu, Sep 30, 2010 at 1:47 PM, Lion Kimbro wrote: > >> >> Hi all, >> >> For many reasons, but mainly just for fun, I made some tkinter >> documentation in pixel graphics. >> >> I'd like to share what I made, here it is..! >> >> [image: grid_layout.png][image: button.png] >> >> It's pretty exhausting work, making letters pixel by pixel, but I like >> the results (assuming you can even see them.) >> >> If I receive encouragement and interesting criticism, I think I'll be >> motivated to make a few more. {:)}= >> I think next, I want to document row & column configuration on the Grid, >> and perhaps how Images work. >> >> Please feel free to share these however you like. >> >> Take care, >> Lion >> >> >> (If the images don't go through the mail, here are two URLs to them: >> http://twitpic.com/2t4n9p/full >> http://twitpic.com/2t4n9q/full ) >> >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: button.png Type: image/png Size: 4287 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: grid_layout.png Type: image/png Size: 5995 bytes Desc: not available URL: From greg.ewing at canterbury.ac.nz Fri Oct 1 05:26:37 2010 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 01 Oct 2010 16:26:37 +1300 Subject: [Tkinter-discuss] Visual (8-bit!) tkinter Cheatsheets In-Reply-To: References: Message-ID: <4CA554ED.8090407@canterbury.ac.nz> On 01/10/10 07:47, Lion Kimbro wrote: > It's pretty exhausting work, making letters pixel by pixel, Yeow! Documenting the layout parameters using diagrams is a good idea, but surely there are less masochistic ways of going about it? -- Greg From ozgulfirat at gmail.com Sat Oct 2 13:23:30 2010 From: ozgulfirat at gmail.com (Firat Ozgul) Date: Sat, 2 Oct 2010 14:23:30 +0300 Subject: [Tkinter-discuss] How do I delete the current line in a Text widget In-Reply-To: <29852273.post@talk.nabble.com> References: <29852273.post@talk.nabble.com> Message-ID: You can use "current linestart" and "current lineend". For example http://paste-it.net/public/x8d0f7b/ 2010/9/30 Baz79 > > What arguments should delete() take in order to delete the current line? > > Thanks, > > Barry > -- > View this message in context: > http://old.nabble.com/How-do-I-delete-the-current-line-in-a-Text-widget-tp29852273p29852273.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From embirath at gmail.com Fri Oct 8 00:27:06 2010 From: embirath at gmail.com (embirath) Date: Thu, 7 Oct 2010 15:27:06 -0700 (PDT) Subject: [Tkinter-discuss] tkinter X11 vs Aqua on a Mac Message-ID: <29910889.post@talk.nabble.com> Hi all I have written a python GUI program using tkinter, which works well on a windows pc. On a Mac however, there are some issues. When I run the program on the version of Python which came with the Mac computer, X11 is not used. Instead, Aqua is used. When Aqua is used, un-editable Entry fields appear in the same color as editable Entry fields. There are other issues as well, but generally X11 simply looks much nicer... I know it is possible to run the tkinter program with X11 on the Mac, because that is what happens when I run my program through the version of python that was installed with this other software package called Scisoft... Unfortunately, Scisoft is running an old version of python (2.4) and there are other things that break in my program because of this older version. So I'm wondering how I can force my tkinter program use X11 instead of Aqua? Any ideas? Thank you, Emma -- View this message in context: http://old.nabble.com/tkinter-X11-vs-Aqua-on-a-Mac-tp29910889p29910889.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From kw at codebykevin.com Fri Oct 8 15:20:00 2010 From: kw at codebykevin.com (Kevin Walzer) Date: Fri, 08 Oct 2010 09:20:00 -0400 Subject: [Tkinter-discuss] tkinter X11 vs Aqua on a Mac In-Reply-To: <29910889.post@talk.nabble.com> References: <29910889.post@talk.nabble.com> Message-ID: <4CAF1A80.3010709@codebykevin.com> On 10/7/10 6:27 PM, embirath wrote: > > So I'm wondering how I can force my tkinter program use X11 instead of Aqua? > Any ideas? There's no way to do it with the Apple-installed Python; it links to the Aqua version of Tk. You can probably set this up by installing Python and Tk/Tkinter from MacPorts or Fink. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From embirath at gmail.com Fri Oct 8 23:51:42 2010 From: embirath at gmail.com (embirath) Date: Fri, 8 Oct 2010 14:51:42 -0700 (PDT) Subject: [Tkinter-discuss] tkinter X11 vs Aqua on a Mac In-Reply-To: <4CAF1A80.3010709@codebykevin.com> References: <29910889.post@talk.nabble.com> <4CAF1A80.3010709@codebykevin.com> Message-ID: <29919353.post@talk.nabble.com> Thanks Kevin. Of course, when I try to install python through Fink I run into some errors: "could not determine XFree86 version number". I'll have to work more on this next week, but if you have any advice let me know. Thanks for your help! Em Kevin Walzer-5 wrote: > > On 10/7/10 6:27 PM, embirath wrote: > >> >> So I'm wondering how I can force my tkinter program use X11 instead of >> Aqua? >> Any ideas? > > There's no way to do it with the Apple-installed Python; it links to the > Aqua version of Tk. > > You can probably set this up by installing Python and Tk/Tkinter from > MacPorts or Fink. > > --Kevin > > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://old.nabble.com/tkinter-X11-vs-Aqua-on-a-Mac-tp29910889p29919353.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From jacob.valenta at gmail.com Fri Oct 8 22:10:34 2010 From: jacob.valenta at gmail.com (Wave71) Date: Fri, 8 Oct 2010 13:10:34 -0700 (PDT) Subject: [Tkinter-discuss] Tkinter doesnt respond until after wait command Message-ID: <29918684.post@talk.nabble.com> I create and object (text) then I want it to wait for about 3 seconds then I want it to delete that object import time text = w.create_text(x,y, text) time.sleep(3) w.delete(text) But when I execute this, It waits until the sleep time is done, and then it displays the window, but by then, the text has already disappeared! what should I do? -- View this message in context: http://old.nabble.com/Tkinter-doesnt-respond-until-after-wait-command-tp29918684p29918684.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From jacob.valenta at gmail.com Fri Oct 8 23:49:05 2010 From: jacob.valenta at gmail.com (Wave71) Date: Fri, 8 Oct 2010 14:49:05 -0700 (PDT) Subject: [Tkinter-discuss] Tkinter doesnt respond until after wait command Message-ID: <29918684.post@talk.nabble.com> I create and object (text) then I want it to wait for about 3 seconds then I want it to delete that object import time text = w.create_text(x,y, text) time.sleep(3) w.delete(text) But when I execute this, It waits until the sleep time is done, and then it displays the window, but by then, the text has already disappeared! what should I do? -- View this message in context: http://old.nabble.com/Tkinter-doesnt-respond-until-after-wait-command-tp29918684p29918684.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ozgulfirat at gmail.com Sat Oct 9 11:10:35 2010 From: ozgulfirat at gmail.com (Firat Ozgul) Date: Sat, 9 Oct 2010 12:10:35 +0300 Subject: [Tkinter-discuss] Tkinter doesnt respond until after wait command In-Reply-To: <29918684.post@talk.nabble.com> References: <29918684.post@talk.nabble.com> Message-ID: Hello, Take a look at this code: http://paste-it.net/public/l0b490d/ 2010/10/9 Wave71 > > I create and object (text) > then I want it to wait for about 3 seconds > then I want it to delete that object > > import time > > text = w.create_text(x,y, text) > time.sleep(3) > w.delete(text) > > > But when I execute this, It waits until the sleep time is done, and then it > displays the window, but by then, the text has already disappeared! > > what should I do? > -- > View this message in context: > http://old.nabble.com/Tkinter-doesnt-respond-until-after-wait-command-tp29918684p29918684.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Fri Oct 15 07:44:25 2010 From: nad at acm.org (Ned Deily) Date: Thu, 14 Oct 2010 22:44:25 -0700 Subject: [Tkinter-discuss] tkinter X11 vs Aqua on a Mac References: <29910889.post@talk.nabble.com> <4CAF1A80.3010709@codebykevin.com> <29919353.post@talk.nabble.com> Message-ID: In article <29919353.post at talk.nabble.com>, embirath wrote: > Thanks Kevin. Of course, when I try to install python through Fink I run into > some errors: "could not determine XFree86 version number". I'll have to > work more on this next week, but if you have any advice let me know. Use MacPorts. On both10.5 and 10.6, I've installed the current MacPorts python2.6 and python3.2 which links with the MacPorts Tk 8.5. That pulls in the MacPorts X11 client libraries but it works just fine with the Apple-supplied X11.app, i.e. no need to build an Xserver. -- Ned Deily, nad at acm.org From Daniel.Schep at srnl.doe.gov Mon Oct 18 16:39:58 2010 From: Daniel.Schep at srnl.doe.gov (Daniel.Schep at srnl.doe.gov) Date: Mon, 18 Oct 2010 10:39:58 -0400 Subject: [Tkinter-discuss] Tkinter vs Tk strangness Message-ID: Hello all. I've been working on a converting a program from Tcl to Python for maintainability reasons and ran into a very strange problem (on Windows XP, using classic theme, if that's relevant). I haven't been able to find it documented any where. Essentially there is a permanent 'shadow' underneath disabled button text in Tkinter that is not permanent in Tk. A set of codes that demonstrates this difference is: Tcl: button .b -text weird -state disabled -font "system 20" -bg blue2 pack .b Python: from Tkinter import * r = Tk() b = Button(r, text='weird', state=DISABLED, font="system 20", bg='blue2') b.pack() Here is a set of images that demonstrates the problem on my machine, with Python 2.5.6 from Python.org (which uses Tk 8.5.2.2) and Tcl 8.5.9 from ActiveState. http://imgur.com/a/hzAJn/tkinter_vs_tk_weirdness Thanks - Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Mon Oct 18 20:37:42 2010 From: klappnase at web.de (Michael Lange) Date: Mon, 18 Oct 2010 20:37:42 +0200 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: References: Message-ID: <20101018203742.b7dd9be9.klappnase@web.de> Hi Daniel, Thus spoketh Daniel.Schep at srnl.doe.gov unto us on Mon, 18 Oct 2010 10:39:58 -0400: (...) > A set of codes that demonstrates this difference is: > > Tcl: > button .b -text weird -state disabled -font "system 20" -bg blue2 > pack .b > > Python: > from Tkinter import * > r = Tk() > b = Button(r, text='weird', state=DISABLED, font="system 20", > bg='blue2') b.pack() > > > Here is a set of images that demonstrates the problem on my machine, > with Python 2.5.6 from Python.org (which uses Tk 8.5.2.2) and Tcl 8.5.9 > from ActiveState. > > http://imgur.com/a/hzAJn/tkinter_vs_tk_weirdness Have you tried to run the tcl example with the Tcl/Tk version shipped with Python? My first guess would be, that it is a problem with this Tk version and has nothing to do with Python. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Beam me up, Scotty, there's no intelligent life down here! From Daniel.Schep at srnl.doe.gov Mon Oct 18 21:57:48 2010 From: Daniel.Schep at srnl.doe.gov (Daniel.Schep at srnl.doe.gov) Date: Mon, 18 Oct 2010 15:57:48 -0400 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: <20101018203742.b7dd9be9.klappnase@web.de> References: <20101018203742.b7dd9be9.klappnase@web.de> Message-ID: I wanted to do this instead of using the Tcl from ActiveState but couldn't find a tclsh or wish executable in Python's Tcl install. How would I run code using Python's Tcl distribution? From: Michael Lange To: tkinter-discuss at python.org Date: 10/18/2010 02:43 PM Subject: Re: [Tkinter-discuss] Tkinter vs Tk strangness Sent by: tkinter-discuss-bounces+daniel.schep=srnl.doe.gov at python.org Hi Daniel, Thus spoketh Daniel.Schep at srnl.doe.gov unto us on Mon, 18 Oct 2010 10:39:58 -0400: (...) > A set of codes that demonstrates this difference is: > > Tcl: > button .b -text weird -state disabled -font "system 20" -bg blue2 > pack .b > > Python: > from Tkinter import * > r = Tk() > b = Button(r, text='weird', state=DISABLED, font="system 20", > bg='blue2') b.pack() > > > Here is a set of images that demonstrates the problem on my machine, > with Python 2.5.6 from Python.org (which uses Tk 8.5.2.2) and Tcl 8.5.9 > from ActiveState. > > http://imgur.com/a/hzAJn/tkinter_vs_tk_weirdness Have you tried to run the tcl example with the Tcl/Tk version shipped with Python? My first guess would be, that it is a problem with this Tk version and has nothing to do with Python. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Beam me up, Scotty, there's no intelligent life down here! _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From siatogia at yahoo.com Mon Oct 18 23:50:51 2010 From: siatogia at yahoo.com (thea_t) Date: Mon, 18 Oct 2010 14:50:51 -0700 (PDT) Subject: [Tkinter-discuss] Can't do proper event binding in a for loop Message-ID: <29995174.post@talk.nabble.com> Hi everyone, I've been writing a long GUI in Python using Tkinter. One thing that I don't understand is why I can't bind events to widgets in a loop. In the code below, binding works well if I do it manually (commented out code) but not in a for loop. Am I doing something wrong? http://old.nabble.com/file/p29995174/events.py events.py -- View this message in context: http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p29995174.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From ozgulfirat at gmail.com Tue Oct 19 12:19:03 2010 From: ozgulfirat at gmail.com (Firat Ozgul) Date: Tue, 19 Oct 2010 13:19:03 +0300 Subject: [Tkinter-discuss] Can't do proper event binding in a for loop In-Reply-To: <29995174.post@talk.nabble.com> References: <29995174.post@talk.nabble.com> Message-ID: Hello, for loop doesn't work, because in a for loop all events will be bound all at once, and you will only see the effect of the last binding. You need something that binds events one by one. If I were you, I would use the next() method of Python iterators: http://paste-it.net/public/pe0b871/ Firat 2010/10/19 thea_t > > Hi everyone, > > I've been writing a long GUI in Python using Tkinter. One thing that I > don't > understand is why I can't bind events to widgets in a loop. In the code > below, binding works well if I do it manually (commented out code) but not > in a for loop. Am I doing something wrong? > > http://old.nabble.com/file/p29995174/events.py events.py > -- > View this message in context: > http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p29995174.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Tue Oct 19 13:24:34 2010 From: klappnase at web.de (Michael Lange) Date: Tue, 19 Oct 2010 13:24:34 +0200 Subject: [Tkinter-discuss] Can't do proper event binding in a for loop In-Reply-To: References: <29995174.post@talk.nabble.com> Message-ID: <20101019132434.6efb5b12.klappnase@web.de> Hi, Thus spoketh Firat Ozgul unto us on Tue, 19 Oct 2010 13:19:03 +0300: > Hello, > > for loop doesn't work, because in a for loop all events will be bound > all at once, and you will only see the effect of the last binding. You > need something that binds events one by one. > > If I were you, I would use the next() method of Python iterators: I think the OP suffered from a different problem in her code, namely the IndexError that will be raised when i+1 or i-1 become >2 or <0 . I guess what she wanted to achieve can be done, but not with this simple lambda, she needs to catch the IndexError with something like: def up_and_down(*buttons): def callback(event): index = list(buttons).index(event.widget) try: if event.keysym == 'Up': buttons[index - 1].focus_set() elif event.keysym == 'Down': buttons[index + 1].focus_set() except IndexError: pass for i in range(len(buttons)-1): buttons[i].bind("", callback) for i in range(1, len(buttons)): buttons[i].bind("", callback) I hope this helps Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Wait! You have not been prepared! -- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2 From siatogia at yahoo.com Tue Oct 19 14:01:43 2010 From: siatogia at yahoo.com (thea_t) Date: Tue, 19 Oct 2010 05:01:43 -0700 (PDT) Subject: [Tkinter-discuss] Can't do proper event binding in a for loop In-Reply-To: <20101019132434.6efb5b12.klappnase@web.de> References: <29995174.post@talk.nabble.com> <20101019132434.6efb5b12.klappnase@web.de> Message-ID: <29999446.post@talk.nabble.com> Thank you guys! I know what's wrong now! :) Michael Lange wrote: > > Hi, > > Thus spoketh Firat Ozgul > unto us on Tue, 19 Oct 2010 13:19:03 +0300: > >> Hello, >> >> for loop doesn't work, because in a for loop all events will be bound >> all at once, and you will only see the effect of the last binding. You >> need something that binds events one by one. >> >> If I were you, I would use the next() method of Python iterators: > > I think the OP suffered from a different problem in her code, namely the > IndexError that will be raised when i+1 or i-1 become >2 or <0 . > I guess what she wanted to achieve can be done, but not with this simple > lambda, she needs to catch the IndexError with something like: > > def up_and_down(*buttons): > > def callback(event): > index = list(buttons).index(event.widget) > try: > if event.keysym == 'Up': > buttons[index - 1].focus_set() > elif event.keysym == 'Down': > buttons[index + 1].focus_set() > except IndexError: > pass > > for i in range(len(buttons)-1): > buttons[i].bind("", callback) > > for i in range(1, len(buttons)): > buttons[i].bind("", callback) > > I hope this helps > > Michael > > .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. > > Wait! You have not been prepared! > -- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2 > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p29999446.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From klappnase at web.de Tue Oct 19 21:16:24 2010 From: klappnase at web.de (Michael Lange) Date: Tue, 19 Oct 2010 21:16:24 +0200 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: References: <20101018203742.b7dd9be9.klappnase@web.de> Message-ID: <20101019211624.5f5873ed.klappnase@web.de> Hi, Thus spoketh Daniel.Schep at srnl.doe.gov unto us on Mon, 18 Oct 2010 15:57:48 -0400: > I wanted to do this instead of using the Tcl from ActiveState but > couldn't find a tclsh or wish executable in Python's Tcl install. How > would I run code using Python's Tcl distribution? > I don't use windows regularly, so I forgot about that :) Anyway, I tried it here on a windows2k system where Python2.6.3 (Tk8.5.2) and Python2.5.4 (Tk8.4.12) are installed. The same effect you described occurs with Python2.6 but not with Python2.5 . Of course I can only guess, but I believe that it's probably a problem with early versions of Tk8.5 that has already been fixed in the latest ActiveTcl. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. It is undignified for a woman to play servant to a man who is not hers. -- Spock, "Amok Time", stardate 3372.7 From michael.odonnell at uam.es Tue Oct 19 21:43:57 2010 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Tue, 19 Oct 2010 21:43:57 +0200 Subject: [Tkinter-discuss] Can't do proper event binding in a for loop In-Reply-To: <29999446.post@talk.nabble.com> References: <29995174.post@talk.nabble.com> <20101019132434.6efb5b12.klappnase@web.de> <29999446.post@talk.nabble.com> Message-ID: Much simpler, and closer to the original posters intention. Replace your up_and_down function with: def up_and_down(*buttons): for i in range(len(buttons)-1): buttons[i].bind("", lambda e, x=buttons[i+1]: x.focus_set()) for i in range(1, len(buttons)): buttons[i].bind("", lambda e, x=buttons[i-1]: x.focus_set()) ...basically, with this code, the "i" is being evaluated within the loop, and passed to the lambda as the x parameter. The 'e' parameter will be set to the event object. Mick On Tue, Oct 19, 2010 at 2:01 PM, thea_t wrote: > > Thank you guys! I know what's wrong now! :) > > > > Michael Lange wrote: >> >> Hi, >> >> Thus spoketh Firat Ozgul >> unto us on Tue, 19 Oct 2010 13:19:03 +0300: >> >>> Hello, >>> >>> for loop doesn't work, because in a for loop all events will be bound >>> all at once, and you will only see the effect of the last binding. You >>> need something that binds events one by one. >>> >>> If I were you, I would use the next() method of Python iterators: >> >> I think the OP suffered from a different problem in her code, namely the >> IndexError that will be raised when i+1 or i-1 become >2 or <0 . >> I guess what she wanted to achieve can be done, but not with this simple >> lambda, she needs to catch the IndexError with something like: >> >> def up_and_down(*buttons): >> >> ? ? def callback(event): >> ? ? ? ? index = list(buttons).index(event.widget) >> ? ? ? ? try: >> ? ? ? ? ? ? if event.keysym == 'Up': >> ? ? ? ? ? ? ? ? buttons[index - 1].focus_set() >> ? ? ? ? ? ? elif event.keysym == 'Down': >> ? ? ? ? ? ? ? ? buttons[index + 1].focus_set() >> ? ? ? ? except IndexError: >> ? ? ? ? ? ? pass >> >> ? ? for i in range(len(buttons)-1): >> ? ? ? ? buttons[i].bind("", callback) >> >> ? ? for i in range(1, len(buttons)): >> ? ? ? ? buttons[i].bind("", callback) >> >> I hope this helps >> >> Michael >> >> .-.. .. ...- . ? .-.. --- -. --. ? .- -. -.. ? .--. .-. --- ... .--. . .-. >> >> Wait! ?You have not been prepared! >> ? ? ? ? ? ? ? -- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2 >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > > -- > View this message in context: http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p29999446.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From Daniel.Schep at srnl.doe.gov Tue Oct 19 21:48:09 2010 From: Daniel.Schep at srnl.doe.gov (Daniel.Schep at srnl.doe.gov) Date: Tue, 19 Oct 2010 15:48:09 -0400 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: <20101019211624.5f5873ed.klappnase@web.de> References: <20101018203742.b7dd9be9.klappnase@web.de> <20101019211624.5f5873ed.klappnase@web.de> Message-ID: I've tested Python2.7 and it exhibits the same problems so it must not ship with a new enough version of Tcl either. What are my options? If I'm not mistaken I can't just swap the version of Tcl used by Python, but building Python from source (on windows) seems like a headache. Is it possible to rebuild just Tkinter with a different version of Tcl somehow? From: Michael Lange To: tkinter-discuss at python.org Date: 10/19/2010 03:23 PM Subject: Re: [Tkinter-discuss] Tkinter vs Tk strangness Sent by: tkinter-discuss-bounces+daniel.schep=srnl.doe.gov at python.org Hi, Thus spoketh Daniel.Schep at srnl.doe.gov unto us on Mon, 18 Oct 2010 15:57:48 -0400: > I wanted to do this instead of using the Tcl from ActiveState but > couldn't find a tclsh or wish executable in Python's Tcl install. How > would I run code using Python's Tcl distribution? > I don't use windows regularly, so I forgot about that :) Anyway, I tried it here on a windows2k system where Python2.6.3 (Tk8.5.2) and Python2.5.4 (Tk8.4.12) are installed. The same effect you described occurs with Python2.6 but not with Python2.5 . Of course I can only guess, but I believe that it's probably a problem with early versions of Tk8.5 that has already been fixed in the latest ActiveTcl. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. It is undignified for a woman to play servant to a man who is not hers. -- Spock, "Amok Time", stardate 3372.7 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Tue Oct 19 22:15:53 2010 From: klappnase at web.de (Michael Lange) Date: Tue, 19 Oct 2010 22:15:53 +0200 Subject: [Tkinter-discuss] Can't do proper event binding in a for loop In-Reply-To: References: <29995174.post@talk.nabble.com> <20101019132434.6efb5b12.klappnase@web.de> <29999446.post@talk.nabble.com> Message-ID: <20101019221553.a8485a5d.klappnase@web.de> Thus spoketh "Michael O'Donnell" unto us on Tue, 19 Oct 2010 21:43:57 +0200: > Much simpler, and closer to the original posters intention. > Replace your up_and_down function with: > > def up_and_down(*buttons): > > for i in range(len(buttons)-1): > buttons[i].bind("", lambda e, x=buttons[i+1]: x.focus_set()) > > for i in range(1, len(buttons)): > buttons[i].bind("", lambda e, x=buttons[i-1]: x.focus_set()) > Sure, you're right. Here's another, even simpler, candidate: def up_and_down(*buttons): for b in buttons[:-1]: b.bind('', lambda event: b.event_generate('')) for b in buttons[1:]: b.bind('', lambda event: b.event_generate('')) Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. I'm frequently appalled by the low regard you Earthmen have for life. -- Spock, "The Galileo Seven", stardate 2822.3 From klappnase at web.de Tue Oct 19 22:36:42 2010 From: klappnase at web.de (Michael Lange) Date: Tue, 19 Oct 2010 22:36:42 +0200 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: References: <20101018203742.b7dd9be9.klappnase@web.de> <20101019211624.5f5873ed.klappnase@web.de> Message-ID: <20101019223642.1e141fc2.klappnase@web.de> Hi, Thus spoketh Daniel.Schep at srnl.doe.gov unto us on Tue, 19 Oct 2010 15:48:09 -0400: > I've tested Python2.7 and it exhibits the same problems so it must not > ship with a new enough version of Tcl either. As far as I see, Python2.7 still comes with Tk8.5.2 . > > What are my options? If I'm not mistaken I can't just swap the version > of Tcl used by Python, but building Python from source (on windows) > seems like a headache. Is it possible to rebuild just Tkinter with a > different version of Tcl somehow? > I agree, I think building python on windows is not trivial. So I think, if you don't want to build Python from sources (which seems to me a lot of work for such a tiny bug), your options seem to be: Downgrade to Python2.5, if you don't depend on some new Python2.6 features or Try ActivePython, maybe they have a more current Tk version included or Try a step ahead into the future to Python3, maybe there's a newer Tk version included or Try to live with it; if this is the only problem you have with your Python version this is what I'd do (remember, if it's really an already fixed Tk bug, time is on your side :) Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Bones: "The man's DEAD, Jim!" From siatogia at yahoo.com Tue Oct 19 23:18:51 2010 From: siatogia at yahoo.com (thea_t) Date: Tue, 19 Oct 2010 14:18:51 -0700 (PDT) Subject: [Tkinter-discuss] Can't do proper event binding in a for loop In-Reply-To: References: <29995174.post@talk.nabble.com> <20101019132434.6efb5b12.klappnase@web.de> <29999446.post@talk.nabble.com> Message-ID: <30004560.post@talk.nabble.com> Very clever! Thanks! Mick O'Donnell wrote: > > Much simpler, and closer to the original posters intention. > Replace your up_and_down function with: > > def up_and_down(*buttons): > > for i in range(len(buttons)-1): > buttons[i].bind("", lambda e, x=buttons[i+1]: x.focus_set()) > > for i in range(1, len(buttons)): > buttons[i].bind("", lambda e, x=buttons[i-1]: x.focus_set()) > > > ...basically, with this code, the "i" is being evaluated within the loop, > and passed to the lambda as the x parameter. The 'e' parameter > will be set to the event object. > > Mick > > > On Tue, Oct 19, 2010 at 2:01 PM, thea_t wrote: >> >> Thank you guys! I know what's wrong now! :) >> >> >> >> Michael Lange wrote: >>> >>> Hi, >>> >>> Thus spoketh Firat Ozgul >>> unto us on Tue, 19 Oct 2010 13:19:03 +0300: >>> >>>> Hello, >>>> >>>> for loop doesn't work, because in a for loop all events will be bound >>>> all at once, and you will only see the effect of the last binding. You >>>> need something that binds events one by one. >>>> >>>> If I were you, I would use the next() method of Python iterators: >>> >>> I think the OP suffered from a different problem in her code, namely the >>> IndexError that will be raised when i+1 or i-1 become >2 or <0 . >>> I guess what she wanted to achieve can be done, but not with this simple >>> lambda, she needs to catch the IndexError with something like: >>> >>> def up_and_down(*buttons): >>> >>> ? ? def callback(event): >>> ? ? ? ? index = list(buttons).index(event.widget) >>> ? ? ? ? try: >>> ? ? ? ? ? ? if event.keysym == 'Up': >>> ? ? ? ? ? ? ? ? buttons[index - 1].focus_set() >>> ? ? ? ? ? ? elif event.keysym == 'Down': >>> ? ? ? ? ? ? ? ? buttons[index + 1].focus_set() >>> ? ? ? ? except IndexError: >>> ? ? ? ? ? ? pass >>> >>> ? ? for i in range(len(buttons)-1): >>> ? ? ? ? buttons[i].bind("", callback) >>> >>> ? ? for i in range(1, len(buttons)): >>> ? ? ? ? buttons[i].bind("", callback) >>> >>> I hope this helps >>> >>> Michael >>> >>> .-.. .. ...- . ? .-.. --- -. --. ? .- -. -.. ? .--. .-. --- ... .--. . >>> .-. >>> >>> Wait! ?You have not been prepared! >>> ? ? ? ? ? ? ? -- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2 >>> _______________________________________________ >>> Tkinter-discuss mailing list >>> Tkinter-discuss at python.org >>> http://mail.python.org/mailman/listinfo/tkinter-discuss >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p29999446.html >> Sent from the Python - tkinter-discuss mailing list archive at >> Nabble.com. >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://old.nabble.com/Can%27t-do-proper-event-binding-in-a-for-loop-tp29995174p30004560.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From Daniel.Schep at srnl.doe.gov Wed Oct 20 14:19:59 2010 From: Daniel.Schep at srnl.doe.gov (Daniel.Schep at srnl.doe.gov) Date: Wed, 20 Oct 2010 08:19:59 -0400 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: <20101019223642.1e141fc2.klappnase@web.de> References: <20101018203742.b7dd9be9.klappnase@web.de> <20101019211624.5f5873ed.klappnase@web.de> <20101019223642.1e141fc2.klappnase@web.de> Message-ID: Your suggestion of ActivePython worked. Since I wanted to stick to the Python.org Python distribution I just installed it with out Tcl/Tk and copied the relevant bits over from the ActivePython install. From: Michael Lange To: tkinter-discuss at python.org Date: 10/19/2010 04:39 PM Subject: Re: [Tkinter-discuss] Tkinter vs Tk strangness Sent by: tkinter-discuss-bounces+daniel.schep=srnl.doe.gov at python.org Hi, Thus spoketh Daniel.Schep at srnl.doe.gov unto us on Tue, 19 Oct 2010 15:48:09 -0400: > I've tested Python2.7 and it exhibits the same problems so it must not > ship with a new enough version of Tcl either. As far as I see, Python2.7 still comes with Tk8.5.2 . > > What are my options? If I'm not mistaken I can't just swap the version > of Tcl used by Python, but building Python from source (on windows) > seems like a headache. Is it possible to rebuild just Tkinter with a > different version of Tcl somehow? > I agree, I think building python on windows is not trivial. So I think, if you don't want to build Python from sources (which seems to me a lot of work for such a tiny bug), your options seem to be: Downgrade to Python2.5, if you don't depend on some new Python2.6 features or Try ActivePython, maybe they have a more current Tk version included or Try a step ahead into the future to Python3, maybe there's a newer Tk version included or Try to live with it; if this is the only problem you have with your Python version this is what I'd do (remember, if it's really an already fixed Tk bug, time is on your side :) Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Bones: "The man's DEAD, Jim!" _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: From Daniel.Schep at srnl.doe.gov Wed Oct 20 21:26:44 2010 From: Daniel.Schep at srnl.doe.gov (Daniel.Schep at srnl.doe.gov) Date: Wed, 20 Oct 2010 15:26:44 -0400 Subject: [Tkinter-discuss] Tkinter vs Tk strangness In-Reply-To: <7B465735-4C3C-42A8-AFF8-002C58978282@activestate.com> References: <20101018203742.b7dd9be9.klappnase@web.de> <20101019211624.5f5873ed.klappnase@web.de> <20101019223642.1e141fc2.klappnase@web.de> <7B465735-4C3C-42A8-AFF8-002C58978282@activestate.com> Message-ID: I work with a python.org based distro that has other stuff already added to it by others and don't want to duplicate that effort when I could just copy the important bits from ActivePython into it. From: Sridhar Ratnakumar To: Daniel.Schep at srnl.doe.gov Date: 10/20/2010 02:14 PM Subject: Re: [Tkinter-discuss] Tkinter vs Tk strangness On 2010-10-20, at 5:19 AM, Daniel.Schep at srnl.doe.gov wrote: Your suggestion of ActivePython worked. Since I wanted to stick to the Python.org Python distribution I just installed it with out Tcl/Tk and copied the relevant bits over from the ActivePython install. Hi Daniel, Is there any reason why you do not want to use ActivePython *as a whole*, but prefer to use Python.org's installer with the Tcl/Tk bits from ActivePython? -srid -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Fri Oct 22 19:20:09 2010 From: python at bdurham.com (python at bdurham.com) Date: Fri, 22 Oct 2010 13:20:09 -0400 Subject: [Tkinter-discuss] Python 2.7: Themed "common dialog" tkinter interfaces via Ttk Message-ID: <1287768009.18495.1401451463@webmail.messagingengine.com> I'm cross posting the following question from this thread on stackoverflow.com: http://stackoverflow.com/questions/3991130/python-2-7-themed-comm on-dialog-tkinter-interfaces-via-ttk Python 2.7 (32-bit) Windows: We're experimenting with Python 2.7's support for themed Tkinter (ttk) for simple GUI's and have come away very impressed!! The one area where the new theme support seems to have come up short is how OS specific common dialogs are wrapped. In other words, the MESSAGEBOX and COLORCHOOSER common dialogs have "ugly" looking Win 95 style blocky looking buttons vs. the themed (rounded/gradient) buttons that normally show up on these common dialogs under XP, Vista, and Windows 7. (I'm testing on all 3 platforms with identical, un-themed results). Note: The filedialog common dialogs (askopenfilename, askopenfilenames, asksaveasfilename, askdirectory) are all properly themed. import tkMessageBox as messagebox messagebox.showinfo() import tkColorChooser as colorchooser color = colorchooser.askcolor( parent=root, title='Customize colors' ) Any ideas on what's required to get Tkinter's MESSAGEBOX and COLORCHOOSER common dialogs to be OS theme compatible (at least under Windows XP or higher)? Note that Rafe Kettler just filed the following Bug Report on this: http://bugs.python.org/issue10171 Regards, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From rowen at uw.edu Fri Oct 22 23:24:44 2010 From: rowen at uw.edu (Russell E. Owen) Date: Fri, 22 Oct 2010 14:24:44 -0700 Subject: [Tkinter-discuss] tkFileDialog halts the program while up. Any way around this? Message-ID: When a tkFileDialog is open my program stops processing other events on Mac OS X. The program is a client that needs to regularly process data from a server, and it would be much better if it could keep processing that data. Has anyone figured a way around this that still offers a platform-standard file dialog box? -- Russell From sigma.z.1980 at gmail.com Sun Oct 24 10:10:59 2010 From: sigma.z.1980 at gmail.com (Alex Ter-Sarkissov) Date: Sun, 24 Oct 2010 21:10:59 +1300 Subject: [Tkinter-discuss] problem with pylab/tkinter? Message-ID: hi, the problem might be bit silly... I'm desiging a GUI with Tkinter. Everythin worked (just couple buttons and entries). Then I decided I need to import pylab: from pylab import * as a result, I'm getting an error message TypeError: __init__() got an unexpected keyword argument 'text' which refers to the command line in def __init__(self) self.start_but=Button(root,text='Generate starting population') Like I said earlier, if I do not import pylab/matplotlib, no error messages are received. cheers, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Sun Oct 24 11:03:14 2010 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Sun, 24 Oct 2010 11:03:14 +0200 Subject: [Tkinter-discuss] problem with pylab/tkinter? In-Reply-To: References: Message-ID: Hi Alex, I don't use pylab, but I would suggest that pylab has a class Button. You are trying to use the tkinter Button. Possible solutions: a) Move you "from tkinter import *" AFTER the pylab import, and possibly this will mean the tkinter Button class will be accessed first. b) Better: don't import the entire pylab module, do: from pylab import myfunct1, myfunct2 (...where myfunct1, myfunct2 are the functions or classes you want to import) c) even better: import tkinter self.start_but=tkinter.Button(root,text='Generate starting population') Mick On Sun, Oct 24, 2010 at 10:10 AM, Alex Ter-Sarkissov wrote: > hi, the problem might be bit silly... > > I'm desiging a GUI with Tkinter. Everythin worked (just couple buttons and > entries). Then I decided I need to import pylab: > > from pylab import * > > as a result, I'm getting an error message > > TypeError: __init__() got an unexpected keyword argument 'text' > > which refers to the command line in def __init__(self) > > self.start_but=Button(root,text='Generate starting population') > > Like I said earlier, if I do not import pylab/matplotlib, no error messages > are received. > > cheers, > > Alex > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From rowen at uw.edu Mon Oct 25 21:02:25 2010 From: rowen at uw.edu (Russell E. Owen) Date: Mon, 25 Oct 2010 12:02:25 -0700 Subject: [Tkinter-discuss] problem with pylab/tkinter? References: Message-ID: I don't think you should mix pylab with matplotlib object API programming (or even the Tkinter event loop), though it may be safe if you are just displaying a plot in a standalone window. It takes a bit more work, but the object API lets you mix matplotlib plots freely with other Tkinter elements. maplotlib comes with good examples for using the object API with Tkinter. If you decide it is safe to use pylab (instead of matplotlib's object API) then at least import pylab using: import pylab instead of from pylab import * to avoid namespace pollution. Using "from import *" is almost never a good idea and pylab is an especially large package. "from pylab import *" can be handy for creating graphs on the fly, but it was never intended for coding into scripts. -- Russell In article , Alex Ter-Sarkissov wrote: > hi, the problem might be bit silly... > > I'm desiging a GUI with Tkinter. Everythin worked (just couple buttons and > entries). Then I decided I need to import pylab: > > from pylab import * > > as a result, I'm getting an error message > > TypeError: __init__() got an unexpected keyword argument 'text' > > which refers to the command line in def __init__(self) > > self.start_but=Button(root,text='Generate starting population') > > Like I said earlier, if I do not import pylab/matplotlib, no error messages > are received. > > cheers, > > Alex > --------------------------------------------------------------------- > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From python at bdurham.com Mon Oct 25 22:45:08 2010 From: python at bdurham.com (python at bdurham.com) Date: Mon, 25 Oct 2010 16:45:08 -0400 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? Message-ID: <1288039508.11440.1401892311@webmail.messagingengine.com> Python 2.7 under Windows: How can we control the position of Tkinter's common dialogs? Here's what we've discovered: * Certain common dialogs always open up relative to their parent window * Certain common dialogs always open up centered on the user's desktop * All common dialogs appear to ignore the optional parent= parameter Questions: * How can we force a dialog to open up relative to its parent window? * How can we force a dialog to open up centered on the user's desktop? Background: import tkColorChooser as colorchooser import tkFileDialog as filedialog import tkMessageBox as messagebox # always open up relative to parent windows fileOpen = filedialog.askopenfilename() fileOpens = filedialog.askopenfilenames() fileSaveAs = filedialog.asksaveasfilename() color = colorchooser.askcolor() # always open up centered on desktop folderOpen = filedialog.askdirectory() messagebox.askquestion() Malcolm From ozgulfirat at gmail.com Tue Oct 26 12:05:34 2010 From: ozgulfirat at gmail.com (Firat Ozgul) Date: Tue, 26 Oct 2010 13:05:34 +0300 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: <1288039508.11440.1401892311@webmail.messagingengine.com> References: <1288039508.11440.1401892311@webmail.messagingengine.com> Message-ID: Hello, I do not know whether there is an easier way to accomplish what you want, but maybe you can create a new toplevel window in the middle of the screen, then make it invisible and position the dialog windows relative to this new toplevel... Like this: http://paste-it.net/public/q2a5594/ I know, this is not nice. Maybe someone else will offer a more "palatable" alternative. Firat 2010/10/25 > Python 2.7 under Windows: How can we control the position of > Tkinter's common dialogs? > > Here's what we've discovered: > > * Certain common dialogs always open up relative to their > parent window > > * Certain common dialogs always open up centered on the user's > desktop > > * All common dialogs appear to ignore the optional parent= > parameter > > Questions: > > * How can we force a dialog to open up relative to its parent > window? > > * How can we force a dialog to open up centered on the user's > desktop? > > Background: > > import tkColorChooser as colorchooser > import tkFileDialog as filedialog > import tkMessageBox as messagebox > > # always open up relative to parent windows > fileOpen = filedialog.askopenfilename() > fileOpens = filedialog.askopenfilenames() > fileSaveAs = filedialog.asksaveasfilename() > color = colorchooser.askcolor() > > # always open up centered on desktop > folderOpen = filedialog.askdirectory() > messagebox.askquestion() > > Malcolm > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Tue Oct 26 19:10:27 2010 From: python at bdurham.com (python at bdurham.com) Date: Tue, 26 Oct 2010 13:10:27 -0400 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: References: <1288039508.11440.1401892311@webmail.messagingengine.com> Message-ID: <1288113027.31765.1402058563@webmail.messagingengine.com> Firat, > You can create a new toplevel window in the middle of the screen, then make it invisible and position the dialog windows relative to this new toplevel... Like this: [1]http://paste-it.net/public/q2a5594/ Thank you very much for your solution - that's an excellent workaround for me. Best regards, Malcolm References 1. http://paste-it.net/public/q2a5594/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.keenan at oracle.com Wed Oct 27 11:58:21 2010 From: matt.keenan at oracle.com (Matt Keenan) Date: Wed, 27 Oct 2010 10:58:21 +0100 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: <1288113027.31765.1402058563@webmail.messagingengine.com> References: <1288039508.11440.1401892311@webmail.messagingengine.com> <1288113027.31765.1402058563@webmail.messagingengine.com> Message-ID: <4CC7F7BD.6070908@oracle.com> Hi, I have a similar issue, however not for common dialogs but for a custom toplevel transient dialogs. As you create your dialog it's dimensions are not known until all idletasks have completed for child widgets being added to the dialog. Now if you call top.widthdraw() before adding the children, the dimensions of the toplevel is not calculated. e.g. class MyDialog(TopLevel): def __init__(self, parent=None, title=None): TopLevel.__init__(self, parent) self.title(title) self.parent = parent self.BuildGUI(master=self) self.CenterDialog() self.transient(parent) def BuildGUI(self, master): # Add widgets here frames etc... pass def CenterDialog(self): self.update_idletasks() w= self["width"]!=0 and self["width"] or self.winfo_width() h= self["height"]!=0 and self["height"] or self.winfo_height() ws,hs = self.winfo_screenwidth(),self.winfo_screenheight() self.geometry('%dx%d+%d+%d' % (w, h, (ws/2) - (w/2), (hs/2) - (h/2))) When above is called, my new toplevel is created, BuildGUI adds all the widgets and the toplevel is displayed, however when CenterDialog is called the toplevel jumps to new centered geometry. Placing self.withdraw() before self.BuildGUI() and then placing self.deiconify() after self.CenterDialog() I thought would do the trick. But I end up with a width and height of 1 in CenterDialog(), withdraw somehow stops calculation taking place. iconify has same effect as withdraw. Any ideas what I am doing wrong ? thanks Matt On 10/26/10 06:10 PM, python at bdurham.com wrote: > Firat, > > You can create a new toplevel window in the middle of the screen, > then make it invisible and position the dialog windows relative to this > new toplevel... Like this: http://paste-it.net/public/q2a5594/ > Thank you very much for your solution - that's an excellent workaround > for me. > Best regards, > Malcolm > > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From python at bdurham.com Wed Oct 27 13:07:40 2010 From: python at bdurham.com (python at bdurham.com) Date: Wed, 27 Oct 2010 07:07:40 -0400 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: <4CC7F7BD.6070908@oracle.com> References: <1288039508.11440.1401892311@webmail.messagingengine.com> <1288113027.31765.1402058563@webmail.messagingengine.com> <4CC7F7BD.6070908@oracle.com> Message-ID: <1288177660.23341.1402194499@webmail.messagingengine.com> Hi Matt, > I have a similar issue, however not for common dialogs but for a custom toplevel transient dialogs. As you create your dialog it's dimensions are not known until all idletasks have completed for child widgets being added to the dialog. Disclaimer: I'm new to Tkinter development so take this untested idea with a grain of salt ... Have you tried positioning your toplevel window off screen (negative coordinates) so that it can be fully rendered (and you can capture its dimensions after all layout calculations have completed), then center your window afterwards? If you come up with a working solution, I would love to hear about it. I'll do the same from my end. Malcolm From sigma.z.1980 at gmail.com Wed Oct 27 13:39:51 2010 From: sigma.z.1980 at gmail.com (Alex Ter-Sarkissov) Date: Thu, 28 Oct 2010 00:39:51 +1300 Subject: [Tkinter-discuss] (no subject) Message-ID: hi, here's my problem: let's say I have a function that uses some widget's property. How canI retireve the value of this property? For example, PopSize=IntVar(); popsize=Entry(root,width=10,textvariable=PopSize) def rand_opo_gen (self,event): popsize_start=#need to get the textvariable value from Entry popsize, not variable PopSize! pop1=random.random(popsize_start*2) Another option, of course, is that the variable PopSize acquires the value from Entry, but I can't see how to do it either cheers, alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Wed Oct 27 14:04:42 2010 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Wed, 27 Oct 2010 14:04:42 +0200 Subject: [Tkinter-discuss] (no subject) In-Reply-To: References: Message-ID: Hi Alex, Your question is not very clear. Why not just use the value of the variable? (Thats what textvariables are for, in any case) As an alternative, you could just get the widget's string directly: string1=popsize.get() Otherwise, please give more context. Mick On Wed, Oct 27, 2010 at 1:39 PM, Alex Ter-Sarkissov wrote: > hi, here's my problem: > > let's say I have a function that uses some widget's property. How canI > retireve the value of this property? > > For example, > > PopSize=IntVar(); > > popsize=Entry(root,width=10,textvariable=PopSize) > > def rand_opo_gen (self,event): > ? ? ? popsize_start=#need to get the textvariable value from Entry > popsize, not variable PopSize! > ? ? ? pop1=random.random(popsize_start*2) > > Another option, of course, is that the variable PopSize acquires the > value from Entry, but I can't see how to do it either > > cheers, > > alex > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From matt.keenan at oracle.com Wed Oct 27 14:27:28 2010 From: matt.keenan at oracle.com (Matt Keenan) Date: Wed, 27 Oct 2010 13:27:28 +0100 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: <1288177660.23341.1402194499@webmail.messagingengine.com> References: <1288039508.11440.1401892311@webmail.messagingengine.com> <1288113027.31765.1402058563@webmail.messagingengine.com> <4CC7F7BD.6070908@oracle.com> <1288177660.23341.1402194499@webmail.messagingengine.com> Message-ID: <4CC81AB0.8030806@oracle.com> Malcolm, Nice idea, but unfortunately don't work... tkinter appears to be smart enough to ensure you cannot place a dialog outside the bounds of the root display size. Using negative values, positions dialog initially at 0,0. Using massive positive values, positions dialog bottom right of screen. Still looking for a nice solution :-) cheers Matt On 10/27/10 12:07 PM, python at bdurham.com wrote: > Hi Matt, > >> I have a similar issue, however not for common dialogs but for a custom > toplevel transient dialogs. As you create your dialog it's dimensions > are not known until all idletasks have completed for child widgets being > added to the dialog. > > Disclaimer: I'm new to Tkinter development so take this untested idea > with a grain of salt ... > > Have you tried positioning your toplevel window off screen (negative > coordinates) so that it can be fully rendered (and you can capture its > dimensions after all layout calculations have completed), then center > your window afterwards? > > If you come up with a working solution, I would love to hear about it. > I'll do the same from my end. > > Malcolm From ral at msbit.com Wed Oct 27 19:32:08 2010 From: ral at msbit.com (Robert A. Lerche) Date: Wed, 27 Oct 2010 10:32:08 -0700 Subject: [Tkinter-discuss] Tkinter issues with Scrollbar and custom widget list Message-ID: I am trying to create a scrolled list built from a custom widget -- similar to a listbox but with multiple entry fields per line (in the real application, there are validation routines associated with each entry field). The attached example demonstrates several problems, the most severe of which is a strange jerky behavior on Windows (not happening on Linux): gently dragging the scroll bar slider to a position where the 7th row (of 10) should be displayed at the top causes jumping between rows 6 and 8. Anybody seen something like this? Any suggestions? Thanks. ===== #! /usr/bin/python # (tested on Windows XP, with Python 2.7 and Tcl/Tk 8.5.2 built entirely # from sources; on Linux using Ubuntu 9.04 distributed packages -- Python # 2.6.2) # Example of a scrolled list bulit from a custom widget # # type1: an Entry field with a StringVar built-in # type2: another Entry field, without the built-in StringVar # frm: a Frame build from two type1's and one type2, with some Labels # testlist: a scrolling list of frm's # testcase: build a 3 high testlist with 10 frm's (scrollable) # Issues: # # 1. Moving the slider slightly gives jerky motion due to # redisplaying. To reduce this I check for a small "moveto" # that doesn't change the displayed row and only set the # scrollbar (slider) without redisplaying the list elements. # # 2. on Linux, moving the slider on the scroll bar to the top # sometimes gives a negative "moveto", which I force to 0, or a # "moveto" greater than 1.0, which I force to 1.0. This # doesn't happen on Windows. # # 3. on Windows, using "pack" as shown causes the root window to flash # quite a bit when scrolling (presumably due to the "grid_forget"s # briefly redisplaying the window with fewer rows. This isn't # visible on Linux. As a workaround on Windows I use a Canvas # which hides the flashing. # # 4. (MOST SEVERE) On Windows, with or without the Canvas widget, # moving the slider slowly hits a glitch when row #7 would be # the top row displayed. The slider jumps between a pair of # values (sometimes 0.56 and 0.7, sometimes other values), # causing the window to flash rapidly. I cannot get the slider # to position row #7 at the top -- it jumps to row #8 or row #6 # (or even lower). This does not happen on Linux -- scrolling # is smooth, no glitches. from Tkinter import * import sys class type1(Entry): def __init__(self,master, v='xxx'): self.v = StringVar() self.v.set(v) Entry.__init__(self, master, textvariable=self.v) class type2(Entry): def __init__(self,master, **kw): Entry.__init__(self,master,**kw) class frm(Frame): def __init__(self, master, **kw): Frame.__init__(self) self.x1 = type1(self,**kw) self.x1.pack(side=LEFT) self.fx2 = Frame(self) Label(self, text=' X2').pack(in_=self.fx2,side=LEFT) self.v2 = StringVar() self.v2.set('yy') self.x2 = type2(self,width=5,textvariable=self.v2) self.x2.pack(in_=self.fx2,side=LEFT) self.fx2.pack(side=LEFT) self.fx3 = Frame(self) Label(self,text=' X3').pack(in_=self.fx3,side=LEFT) self.x3 = type1(self, v='zzz') self.x3.pack(in_=self.fx3,side=LEFT) self.fx3.pack(side=LEFT) class testlist(Frame): def __init__(self, master, maxdisp=3, **kw): Frame.__init__(self,master) self.sb = Scrollbar(self, command=self.scroll) self.sb.grid(in_=self,row=0,column=1,rowspan=maxdisp,sticky=N+S) self.maxdisp = maxdisp self.frms = [frm(self,**kw)] self.active = 0 self.frms[0].grid(in_=self,row=0,column=0) def setsb(self,start,mv): dispfrac = self.maxdisp / float(len(self.frms)) startfrac = float(start) / len(self.frms) if mv == None: self.sb.set(startfrac, min(1, startfrac+dispfrac)) else: self.sb.set(mv, min(1, mv+dispfrac)) def redisp(self, start, mv=None): for xx in self.frms[self.active:self.maxdisp+self.active]: xx.grid_forget() yy = 0 for xx in self.frms[start:self.maxdisp+start]: xx.grid(in_=self,row=yy,column=0) yy += 1 self.setsb(start,mv) # print start, startfrac, min(1, startfrac+dispfrac) self.active = start def addentry(self, **kw): self.frms.append(frm(self,**kw)) # perhaps move to the end of the list ? self.redisp(self.active) def scroll(self,*xx): op, cnt = xx[0], xx[1] mv = None if op == "scroll": if xx[2] == 'pages': amt = self.maxdisp * int(xx[1]) else: amt = int(xx[1]) newstart = self.active + amt else: mv = min(1.0,max(0.0,float(cnt))) newstart = int(len(self.frms) * mv) print cnt, mv, newstart newstart = min(newstart, len(self.frms) - self.maxdisp) newstart = max(0, newstart) if newstart <> self.active: self.redisp(newstart,mv=mv) else: self.setsb(newstart,mv) def testcase(master): tt = testlist(master,v='1') for xx in range(2,11): tt.addentry(v=str(xx)) return tt if (__name__ == '__main__'): rr = Tk() try: arg1=sys.argv[1] except IndexError: arg1=None if arg1 == 'c': # use Canvas cc=Canvas(rr,height=300,width=600) cc.pack() tt = testcase(cc) tt.place(x=10, y=10) else: # just pack into root tt = testcase(rr) tt.pack() rr.mainloop() From lionkimbro at gmail.com Wed Oct 27 21:13:03 2010 From: lionkimbro at gmail.com (Lion Kimbro) Date: Wed, 27 Oct 2010 12:13:03 -0700 Subject: [Tkinter-discuss] (no subject) In-Reply-To: References: Message-ID: Alex, does this answer what you're trying to do? >>> import tkinter >>> top = tkinter.Tk() >>> intvar = tkinter.IntVar() >>> entry = tkinter.Entry(top, width=10, textvariable=intvar) >>> entry.grid() >>> intvar.get() 0 >>> # now I set it to 10 in the user interface... ... >>> intvar.get() 10 >>> I found the names of the variables pretty confusing; When I used "intvar" and "entry", it was much clearer to me. You wrote "#need to get the textvariable value from Entry popsize, not variable PopSize!" ...but I thought you were trying to get the widget's property? When you set the value with "textvariable=intvar", the widget is now explicitly delegating the value to intvar. That is, the IntVar becomes the authority for the information. On Wed, Oct 27, 2010 at 4:39 AM, Alex Ter-Sarkissov wrote: > hi, here's my problem: > > let's say I have a function that uses some widget's property. How canI > retireve the value of this property? > > For example, > > PopSize=IntVar(); > > popsize=Entry(root,width=10,textvariable=PopSize) > > def rand_opo_gen (self,event): > popsize_start=#need to get the textvariable value from Entry > popsize, not variable PopSize! > pop1=random.random(popsize_start*2) > > Another option, of course, is that the variable PopSize acquires the > value from Entry, but I can't see how to do it either > > cheers, > alex > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curatelli at unige.it Wed Oct 27 21:41:50 2010 From: curatelli at unige.it (F. Curatelli) Date: Wed, 27 Oct 2010 21:41:50 +0200 Subject: [Tkinter-discuss] Tkinter with Eee Top touchscreen PC In-Reply-To: References: Message-ID: <4CC8807E.2060908@unige.it> Hi all, I've just tried Tkinter on an Asus EeeTop PC with touch screen for an application which needs to manage: 1) directly clicking on specific screen areas, and 2) selection after a dwell time. However in both cases there are some problems. For the first option I've used the recognition of the and events; indeed the two events are managed but this occurs only when the finger/stylus is released (in other words, the press event is not produced until the realease event is produced too). Why does this happen? After all the press acton is recognized by the system, because on the screen a visual feedback (a set of circle shape waves around the touch point) is instead displayed. the The fact that the recognition of the touch is not immediate and has to wait until the realease action does not allow to know when to start the dwell time for the second option. Any idea? Thanks in advance Franco From sigma.z.1980 at gmail.com Wed Oct 27 22:51:36 2010 From: sigma.z.1980 at gmail.com (Alex Ter-Sarkissov) Date: Thu, 28 Oct 2010 09:51:36 +1300 Subject: [Tkinter-discuss] (no subject) In-Reply-To: References: Message-ID: thanks guys, I didn't realize that setting textvariable = varname explicitly delegates the value to this variable. In MATLAB things work differently. cheers, Alex 2010/10/28 Lion Kimbro > > Alex, does this answer what you're trying to do? > > >>> import tkinter > >>> top = tkinter.Tk() > >>> intvar = tkinter.IntVar() > >>> entry = tkinter.Entry(top, width=10, textvariable=intvar) > >>> entry.grid() > >>> intvar.get() > 0 > >>> # now I set it to 10 in the user interface... > ... > >>> intvar.get() > 10 > >>> > > I found the names of the variables pretty confusing; > When I used "intvar" and "entry", it was much clearer to me. > > You wrote "#need to get the textvariable value from Entry popsize, not > variable PopSize!" > > ...but I thought you were trying to get the widget's property? > > When you set the value with "textvariable=intvar", the widget is now > explicitly delegating the value to intvar. > That is, the IntVar becomes the authority for the information. > > > > On Wed, Oct 27, 2010 at 4:39 AM, Alex Ter-Sarkissov < > sigma.z.1980 at gmail.com> wrote: > >> hi, here's my problem: >> >> let's say I have a function that uses some widget's property. How canI >> retireve the value of this property? >> >> For example, >> >> PopSize=IntVar(); >> >> popsize=Entry(root,width=10,textvariable=PopSize) >> >> def rand_opo_gen (self,event): >> popsize_start=#need to get the textvariable value from Entry >> popsize, not variable PopSize! >> pop1=random.random(popsize_start*2) >> >> Another option, of course, is that the variable PopSize acquires the >> value from Entry, but I can't see how to do it either >> >> cheers, >> alex >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmcmonagle at velseis.com Wed Oct 27 23:26:50 2010 From: jmcmonagle at velseis.com (John McMonagle) Date: Thu, 28 Oct 2010 07:26:50 +1000 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: <4CC81AB0.8030806@oracle.com> References: <1288039508.11440.1401892311@webmail.messagingengine.com> <1288113027.31765.1402058563@webmail.messagingengine.com> <4CC7F7BD.6070908@oracle.com> <1288177660.23341.1402194499@webmail.messagingengine.com> <4CC81AB0.8030806@oracle.com> Message-ID: <4CC8991A.9060503@velseis.com.au> On 27/10/10 22:27, Matt Keenan wrote: > Malcolm, > > Nice idea, but unfortunately don't work... tkinter appears to be smart > enough to ensure you cannot place a dialog outside the bounds of the > root display size. > > Using negative values, positions dialog initially at 0,0. > Using massive positive values, positions dialog bottom right of screen. > > Still looking for a nice solution :-) > > cheers > > Matt > > On 10/27/10 12:07 PM, python at bdurham.com wrote: >> Hi Matt, >> >>> I have a similar issue, however not for common dialogs but for a custom >> toplevel transient dialogs. As you create your dialog it's dimensions >> are not known until all idletasks have completed for child widgets being >> added to the dialog. >> >> Disclaimer: I'm new to Tkinter development so take this untested idea >> with a grain of salt ... >> >> Have you tried positioning your toplevel window off screen (negative >> coordinates) so that it can be fully rendered (and you can capture its >> dimensions after all layout calculations have completed), then center >> your window afterwards? >> >> If you come up with a working solution, I would love to hear about it. >> I'll do the same from my end. >> >> Malcolm You need to use the winfo_reqwidth() and winfo_reqheight() methods to determine the windows "requested" width and height. http://www.pythonware.com/library/tkinter/introduction/x9548-window-related-information.htm Regards, John . From matt.keenan at oracle.com Thu Oct 28 11:16:20 2010 From: matt.keenan at oracle.com (Matt Keenan) Date: Thu, 28 Oct 2010 10:16:20 +0100 Subject: [Tkinter-discuss] Control position of Tkinter common dialogs? In-Reply-To: <4CC8991A.9060503@velseis.com.au> References: <1288039508.11440.1401892311@webmail.messagingengine.com> <1288113027.31765.1402058563@webmail.messagingengine.com> <4CC7F7BD.6070908@oracle.com> <1288177660.23341.1402194499@webmail.messagingengine.com> <4CC81AB0.8030806@oracle.com> <4CC8991A.9060503@velseis.com.au> Message-ID: <4CC93F64.4060606@oracle.com> Thanks John, that works a treat... On 10/27/10 10:26 PM, John McMonagle wrote: > On 27/10/10 22:27, Matt Keenan wrote: >> Malcolm, >> >> Nice idea, but unfortunately don't work... tkinter appears to be smart >> enough to ensure you cannot place a dialog outside the bounds of the >> root display size. >> >> Using negative values, positions dialog initially at 0,0. >> Using massive positive values, positions dialog bottom right of screen. >> >> Still looking for a nice solution :-) >> >> cheers >> >> Matt >> >> On 10/27/10 12:07 PM, python at bdurham.com wrote: >>> Hi Matt, >>> >>>> I have a similar issue, however not for common dialogs but for a custom >>> toplevel transient dialogs. As you create your dialog it's dimensions >>> are not known until all idletasks have completed for child widgets being >>> added to the dialog. >>> >>> Disclaimer: I'm new to Tkinter development so take this untested idea >>> with a grain of salt ... >>> >>> Have you tried positioning your toplevel window off screen (negative >>> coordinates) so that it can be fully rendered (and you can capture its >>> dimensions after all layout calculations have completed), then center >>> your window afterwards? >>> >>> If you come up with a working solution, I would love to hear about it. >>> I'll do the same from my end. >>> >>> Malcolm > > > You need to use the winfo_reqwidth() and winfo_reqheight() methods to > determine the windows "requested" width and height. > > http://www.pythonware.com/library/tkinter/introduction/x9548-window-related-information.htm > > Regards, > > John > . From python at bdurham.com Thu Oct 28 18:03:40 2010 From: python at bdurham.com (python at bdurham.com) Date: Thu, 28 Oct 2010 12:03:40 -0400 Subject: [Tkinter-discuss] Cancel a window resize/move event trapped via Message-ID: <1288281820.24257.1402435665@webmail.messagingengine.com> Is it possible to cancel a window event, eg. if one wanted to constrain a window to a certain location on a user's desktop? Returning 'break' from a window's event does not cancel window move or resize events. Thank you, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Thu Oct 28 19:31:42 2010 From: python at bdurham.com (python at bdurham.com) Date: Thu, 28 Oct 2010 13:31:42 -0400 Subject: [Tkinter-discuss] Advanced Text example showing "rich text" like or syntax color coding markup? Message-ID: <1288287102.14412.1402448089@webmail.messagingengine.com> I'm new to Tkinter development. We have a very simple markup language that we would like to "syntax color code" using Tkinter's Text widget. I'm looking for a simple code snippet, demo app, or high-level narrative description that explains how one might do this from one or more of the following perspectives: - initial markup during load - realtime markup while a user edits content (including clipboard pastes) - at file save time when one must walk the editted content To start the discusson, how might one do this with an example markup language with the following syntax? - any word beginning with '*' gets coded blue - any word beginning with '@' gets coded green - all other text has no formatting Thank you, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Fri Oct 29 09:02:36 2010 From: python at bdurham.com (python at bdurham.com) Date: Fri, 29 Oct 2010 03:02:36 -0400 Subject: [Tkinter-discuss] Using Win32 API to get around Tkinter limitations? Message-ID: <1288335756.16999.1402546803@webmail.messagingengine.com> Wondering if there are ways to use the Win32 API to get around the following Tkinter limitations? 1. Inability to set custom mouse cursors via *.cur/*.ani files. 2. Determine the height or width of window properties such as titlebar, left/right and bottom window frame edges? Thank you, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From igor.e.novikov at gmail.com Fri Oct 29 14:38:35 2010 From: igor.e.novikov at gmail.com (Igor Novikov) Date: Fri, 29 Oct 2010 15:38:35 +0300 Subject: [Tkinter-discuss] Using Win32 API to get around Tkinter limitations? In-Reply-To: <1288335756.16999.1402546803@webmail.messagingengine.com> References: <1288335756.16999.1402546803@webmail.messagingengine.com> Message-ID: On Fri, Oct 29, 2010 at 10:02 AM, wrote: > Wondering if there are ways to use the Win32 API to get around the > following Tkinter limitations? > If you are familiar with winapi you can try using pywin32 extension: http://sourceforge.net/projects/pywin32/ > > 1. Inability to set custom mouse cursors via *.cur/*.ani files. > Why not use conventional tcl/tk functionality? It seems tcl/tk allows to use cur/ani files for custom cursor: http://wiki.tcl.tk/8674 In *nix environment you can use the same images converted into xcursor resources: http://sk1project.org/viewpage.php?page_id=20 -- Regards, Igor Novikov sK1 Project http://sk1project.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Fri Oct 29 17:41:39 2010 From: python at bdurham.com (python at bdurham.com) Date: Fri, 29 Oct 2010 11:41:39 -0400 Subject: [Tkinter-discuss] Using Win32 API to get around Tkinter limitations? In-Reply-To: References: <1288335756.16999.1402546803@webmail.messagingengine.com> Message-ID: <1288366899.10712.1402614193@webmail.messagingengine.com> Hi Igor, > Why not use conventional tcl/tk functionality? It seems tcl/tk allows to use cur/ani files for custom cursor: > [1]http://wiki.tcl.tk/8674 Thanks for your response. You are correct, under Windows the cursor='@path/to/file.ext' technique works as expected. I had tried that, but from within IDLE (Python 2.7) this syntax raises an exception. Using this technique in scripts running from the command line (outside of IDLE) works well. Malcolm References 1. http://wiki.tcl.tk/8674 -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Fri Oct 29 17:55:24 2010 From: python at bdurham.com (python at bdurham.com) Date: Fri, 29 Oct 2010 11:55:24 -0400 Subject: [Tkinter-discuss] Cross platform way to discover the height/width of window borders/titlebar, etc. Message-ID: <1288367724.14817.1402614825@webmail.messagingengine.com> Is there a cross-platform way to discover the height/width of operating system rendered window borders/titlebars, etc? If not, any suggestions on how one might discover these properties when running under Windows using either ctypes or the pywin32 library? Thank you, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Fri Oct 29 18:31:49 2010 From: python at bdurham.com (python at bdurham.com) Date: Fri, 29 Oct 2010 12:31:49 -0400 Subject: [Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk? Message-ID: <1288369909.24379.1402619385@webmail.messagingengine.com> Any comments on the concerns about ttk portability to Qt and GTk windowing systems? The following is from a recent thread on the python-list mailing list. > Tkinter is built-in and available on Windows, Mac, and Linux. If you're using Python 2.7 or 3.1 you can take advantage of Tkinter's ttk (Tile) support for platform native user interfaces. Reponse: You get a native UI using the correct theme even on Linux under Qt or GTk? >From what I've read of ttk, it still isn't using native UI elements. It just has a bunch of its own "themes" that look mostly/sort-of like native UI elements. Right? Under Linux does ttk automagically pick the theme that looks most like the current Qt or Gtk theme? On systems where both are installed, how does ttk decide whether to look like Qt or Gtk? In addition to looking like native UI elements, does ttk also change UI behaviors to match native UI elements? For example will it automatically use emacs key-bindings for text-entry editing if that's enabled in my Gtk configuration? From igor.e.novikov at gmail.com Fri Oct 29 20:09:49 2010 From: igor.e.novikov at gmail.com (Igor Novikov) Date: Fri, 29 Oct 2010 21:09:49 +0300 Subject: [Tkinter-discuss] Using Win32 API to get around Tkinter limitations? In-Reply-To: <1288366899.10712.1402614193@webmail.messagingengine.com> References: <1288335756.16999.1402546803@webmail.messagingengine.com> <1288366899.10712.1402614193@webmail.messagingengine.com> Message-ID: On Fri, Oct 29, 2010 at 6:41 PM, wrote: > Hi Igor, > > > Why not use conventional tcl/tk functionality? It seems tcl/tk allows to > use cur/ani files for custom cursor: > > http://wiki.tcl.tk/8674 > > Thanks for your response. You are correct, under Windows the > cursor='@path/to/file.ext' technique works as expected. I had tried that, > but from within IDLE (Python 2.7) this syntax raises an exception. Using > this technique in scripts running from the command line (outside of IDLE) > works well. > > Malcolm > > You can try using direct tk command call: any_widget.tk.call('your','tk','command') Please note the command should be splitted on words. -- Regards, Igor Novikov sK1 Project http://sk1project.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Fri Oct 29 20:16:35 2010 From: klappnase at web.de (Michael Lange) Date: Fri, 29 Oct 2010 20:16:35 +0200 Subject: [Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk? In-Reply-To: <1288369909.24379.1402619385@webmail.messagingengine.com> References: <1288369909.24379.1402619385@webmail.messagingengine.com> Message-ID: <20101029201635.ec07582e.klappnase@web.de> Hi, Thus spoketh python at bdurham.com unto us on Fri, 29 Oct 2010 12:31:49 -0400: > Any comments on the concerns about ttk portability to Qt and GTk > windowing systems? > > The following is from a recent thread on the python-list mailing list. > > > Tkinter is built-in and available on Windows, Mac, and Linux. If > you're using Python 2.7 or 3.1 you can take advantage of Tkinter's ttk > (Tile) support for platform native user interfaces. > > Reponse: > > You get a native UI using the correct theme even on Linux under Qt or > GTk? > > >From what I've read of ttk, it still isn't using native UI elements. > It just has a bunch of its own "themes" that look mostly/sort-of like > native UI elements. Right? > In the linux world (or, more correctly, on X) there actually is no such thing as a "native" Gui appearance (what comes closest to a native X appearance is probably the extremely simple look of some apps that come with X by default, like xvidtune and xedit, but you surely would not want this for ttk :). I guess what you probably mean by "Qt and Gtk windowing systems" are the KDE and Gnome desktop environments . There is no way for ttk to detect if one of these or some other Desktop/WM is running and read out its themeing information. Considering how many versions of KDE/Gnome/Xfce/whatever_else are around it seems (at least to me) quite sensible to not even try. Tix used to try something like that, and IIRC it never worked really reliable. The "native" looking themes are "alt" in the first place, which looks more or less similar to a simple Gtk1-theme or Win98 and "clam" which seems to resemble another look that was used in old versions of Gtk. The "classic" theme looks like plain Tk8.4 and "default" is something in between "classic" and "alt". These are all of the built-in themes under linux. There are also a few advanced pixmap themes available at : http://tktable.cvs.sourceforge.net/viewvc/tktable/tile-themes/ According to http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/acedceb8a116b58e/ec9fb25044a68a9c there seem to be other themes available somewhere, and there are tileqt and tilegtk available in the Tile source CVS tree, which will allow you to use any Qt/Gtk theme; I never tried these, though, and I don't know if you can use them with Tk8.5 instead of Tile. > Under Linux does ttk automagically pick the theme that looks most like > the current Qt or Gtk theme? No. The default will always be "default". If you want to use a different theme, you must enable it explicitely. > > On systems where both are installed, how does ttk decide whether to > look like Qt or Gtk? It doesn't. > > In addition to looking like native UI elements, does ttk also change > UI behaviors to match native UI elements? For example will it > automatically use emacs key-bindings for text-entry editing if that's > enabled in my Gtk configuration? I doubt that ttk will do anything like that. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. You go slow, be gentle. It's no one-way street -- you know how you feel and that's all. It's how the girl feels too. Don't press. If the girl feels anything for you at all, you'll know. -- Kirk, "Charlie X", stardate 1535.8 From igor.e.novikov at gmail.com Fri Oct 29 20:34:53 2010 From: igor.e.novikov at gmail.com (Igor Novikov) Date: Fri, 29 Oct 2010 21:34:53 +0300 Subject: [Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk? In-Reply-To: <20101029201635.ec07582e.klappnase@web.de> References: <1288369909.24379.1402619385@webmail.messagingengine.com> <20101029201635.ec07582e.klappnase@web.de> Message-ID: On Fri, Oct 29, 2010 at 9:16 PM, Michael Lange wrote: > > There are also a few advanced pixmap themes available at : > > http://tktable.cvs.sourceforge.net/viewvc/tktable/tile-themes/ > > According to > > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/acedceb8a116b58e/ec9fb25044a68a9c > > there seem to be other themes available somewhere, and there are tileqt > and tilegtk available in the Tile source CVS tree, which will allow you to > use any Qt/Gtk theme; I never tried these, though, and I don't know if > you can use them with Tk8.5 instead of Tile. > You cannot use native themes like tileqt/tilegtk in Ttk widgetset because Ttk native API is not exposed. So you can try using pixmaps themes only. -- Regards, Igor Novikov sK1 Project http://sk1project.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Fri Oct 29 21:18:37 2010 From: klappnase at web.de (Michael Lange) Date: Fri, 29 Oct 2010 21:18:37 +0200 Subject: [Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk? In-Reply-To: References: <1288369909.24379.1402619385@webmail.messagingengine.com> <20101029201635.ec07582e.klappnase@web.de> Message-ID: <20101029211837.009c090f.klappnase@web.de> Hi, Thus spoketh Igor Novikov unto us on Fri, 29 Oct 2010 21:34:53 +0300: > On Fri, Oct 29, 2010 at 9:16 PM, Michael Lange wrote: > > > > > There are also a few advanced pixmap themes available at : > > > > http://tktable.cvs.sourceforge.net/viewvc/tktable/tile-themes/ > > > > According to > > > > > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/acedceb8a116b58e/ec9fb25044a68a9c > > > > there seem to be other themes available somewhere, and there are > > tileqt and tilegtk available in the Tile source CVS tree, which will > > allow you to use any Qt/Gtk theme; I never tried these, though, and I > > don't know if you can use them with Tk8.5 instead of Tile. > > > > You cannot use native themes like tileqt/tilegtk in Ttk widgetset > because Ttk native API is not exposed. So you can try using pixmaps > themes only. > Now I got curious and downloaded the tile-themes package. It seems like I cannot use tileqt/tilegtk with Tk8.4/Tile either, because it fails to compile. I also cannot seem to figure out how to enable the pixmap themes, although I am sure that I successfully used them some time ago. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. In the strict scientific sense we all feed on death -- even vegetarians. -- Spock, "Wolf in the Fold", stardate 3615.4 From igor.e.novikov at gmail.com Fri Oct 29 21:31:11 2010 From: igor.e.novikov at gmail.com (Igor Novikov) Date: Fri, 29 Oct 2010 22:31:11 +0300 Subject: [Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk? In-Reply-To: <20101029211837.009c090f.klappnase@web.de> References: <1288369909.24379.1402619385@webmail.messagingengine.com> <20101029201635.ec07582e.klappnase@web.de> <20101029211837.009c090f.klappnase@web.de> Message-ID: On Fri, Oct 29, 2010 at 10:18 PM, Michael Lange wrote: > Hi, > > Thus spoketh Igor Novikov > unto us on Fri, 29 Oct 2010 21:34:53 +0300: > > > On Fri, Oct 29, 2010 at 9:16 PM, Michael Lange wrote: > > > > > > > > There are also a few advanced pixmap themes available at : > > > > > > http://tktable.cvs.sourceforge.net/viewvc/tktable/tile-themes/ > > > > > > According to > > > > > > > > > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/acedceb8a116b58e/ec9fb25044a68a9c > > > > > > there seem to be other themes available somewhere, and there are > > > tileqt and tilegtk available in the Tile source CVS tree, which will > > > allow you to use any Qt/Gtk theme; I never tried these, though, and I > > > don't know if you can use them with Tk8.5 instead of Tile. > > > > > > > You cannot use native themes like tileqt/tilegtk in Ttk widgetset > > because Ttk native API is not exposed. So you can try using pixmaps > > themes only. > > > > Now I got curious and downloaded the tile-themes package. > It seems like I cannot use tileqt/tilegtk with Tk8.4/Tile either, > because it fails to compile. I also cannot seem to figure out how to > enable the pixmap themes, although I am sure that I successfully used > them some time ago. Pixmap themes should be fixed before using with Ttk in tk8.5/8.6 because they use 'tile' namespace but should be 'ttk' To enable theme you need running following command: widget.tk.call('lappend', 'auto_path', theme_parent_dir) #to make theme accessible for tk widget.tk.call('ttk::setTheme', theme_name) #to set theme using theme name -- Regards, Igor Novikov sK1 Project http://sk1project.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Fri Oct 29 21:57:18 2010 From: klappnase at web.de (Michael Lange) Date: Fri, 29 Oct 2010 21:57:18 +0200 Subject: [Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk? In-Reply-To: References: <1288369909.24379.1402619385@webmail.messagingengine.com> <20101029201635.ec07582e.klappnase@web.de> <20101029211837.009c090f.klappnase@web.de> Message-ID: <20101029215718.e872300e.klappnase@web.de> Hi, Thus spoketh Igor Novikov unto us on Fri, 29 Oct 2010 22:31:11 +0300: > > > Pixmap themes should be fixed before using with Ttk in tk8.5/8.6 > because they use 'tile' namespace but should be 'ttk' > To enable theme you need running following command: > > widget.tk.call('lappend', 'auto_path', theme_parent_dir) #to make > theme accessible for tk > widget.tk.call('ttk::setTheme', theme_name) #to set > theme using theme name > Thanks, you're right, it works. I was fooled by the theme names missing from the output of theme_names(). The pixmap themes only appear in theme_names() after they have been loaded once, which seems a little odd to me. It would be nice if themes that are installed somewhere in auto_path would be returned by theme_names() automagically, so an application could show a list of installed themes and the user can pick one. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. A little suffering is good for the soul. -- Kirk, "The Corbomite Maneuver", stardate 1514.0 From sigma.z.1980 at gmail.com Sun Oct 31 07:57:29 2010 From: sigma.z.1980 at gmail.com (Alex Ter-Sarkissov) Date: Sun, 31 Oct 2010 19:57:29 +1300 Subject: [Tkinter-discuss] entry+value assignment using function Message-ID: hi, here's my situation: I create an Entry outside of a certai function*: self.newlab=Entry(root,state=DISABLED).grid(column=4,row=9)* the function acquires a value (from another Entry) and puts this value into the Entry created in the command above. The way I do it is def pop2pop(self,event): newpop=IntVar() newpop.set(self.PopSize.get()) #newpop=self.PopSize.get() self.newlab['textvariable']=newpop and it doens't work. Suprisingly, when I create the Entry within this function (e.g. self.newlab=Entry(root,textvariable=newpop).grid(column=4,row=9) it works. More over, the assignment of the value to newpop as (newpop=self.PopSize.get()) doesn't work either, so I have to use newpop.set(self.PopSize.get()) instead. what am I doing wrong? cheers, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Sun Oct 31 10:06:06 2010 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Sun, 31 Oct 2010 10:06:06 +0100 Subject: [Tkinter-discuss] entry+value assignment using function In-Reply-To: References: Message-ID: Hi Alex, Note the following line: self.newlab=Entry(root,state=DISABLED).grid(column=4,row=9) What is assigned to self.newlab is the result of the call to the grid function, which is 'None'. What you need to do is: self.newlab=Entry(root,state=DISABLED) self.newlab.grid(column=4,row=9) ...and then your code should work. See demo code below: #========================= from Tkinter import * tk = Tk() class tmp: def __init__(self, root): self.newlab=Entry(root,state=DISABLED) self.newlab.grid(column=4,row=9) self.PopSize=IntVar() self.PopSize.set(7) def pop2pop(self,event): newpop=IntVar() newpop.set(self.PopSize.get()) self.newlab['textvariable']=newpop t=tmp(tk) t.pop2pop(1) tk.mainloop() #+++++++++++++++++++++ On Sun, Oct 31, 2010 at 7:57 AM, Alex Ter-Sarkissov wrote: > hi, here's my situation: > > I create an Entry outside of a certai function: > > self.newlab=Entry(root,state=DISABLED).grid(column=4,row=9) > > the function acquires a value (from another Entry) and puts this value into > the Entry created in the command above. The way I do it is > > def pop2pop(self,event): > > ??????? newpop=IntVar() > ??????? newpop.set(self.PopSize.get()) > ??????? #newpop=self.PopSize.get() > > ??????? self.newlab['textvariable']=newpop > > > and it doens't work. Suprisingly, when I create the Entry within this > function (e.g. > > ? self.newlab=Entry(root,textvariable=newpop).grid(column=4,row=9) > > it works. > > More over, the assignment of the value to newpop as > (newpop=self.PopSize.get()) doesn't work either, so I have to use > newpop.set(self.PopSize.get()) instead. > > what am I doing wrong? > > cheers, > > Alex > > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > >