From jaba at findyourcore.com Sat Jul 1 05:31:24 2006 From: jaba at findyourcore.com (jaba at findyourcore.com) Date: Fri, 30 Jun 2006 23:31:24 -0400 (EDT) Subject: [Tkinter-discuss] Canvas pixels Message-ID: <2849.69.146.105.32.1151724684.squirrel@findyourcore.com> is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas? Thank You From jepler at unpythonic.net Sat Jul 1 15:19:29 2006 From: jepler at unpythonic.net (Jeff Epler) Date: Sat, 1 Jul 2006 08:19:29 -0500 Subject: [Tkinter-discuss] Canvas pixels In-Reply-To: <2849.69.146.105.32.1151724684.squirrel@findyourcore.com> References: <2849.69.146.105.32.1151724684.squirrel@findyourcore.com> Message-ID: <20060701131927.GA4035@unpythonic.net> On Fri, Jun 30, 2006 at 11:31:24PM -0400, jaba at findyourcore.com wrote: > is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas? No, tk doesn't provide a way to do this. Jeff From olivier.feys at gmail.com Mon Jul 3 16:24:43 2006 From: olivier.feys at gmail.com (Olivier Feys) Date: Mon, 03 Jul 2006 16:24:43 +0200 Subject: [Tkinter-discuss] grid sticky problem Message-ID: <44A928AB.5090502@gmail.com> I'm trying to add frames in a master frame with the grid manager, and it seems that the option 'sticky' doesn't work as it should When I change the size of the master frame, the subframes don't want to be resized like expand =1 , fill = 'both' for pack layout manager Thanks for help import Tkinter as tk root = tk.Tk() frames= [] rw = 0 col=0 fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr] fr.grid(row=rw,column=col,sticky='nswe') tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10) col+=1 fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr] fr.grid(row=rw,column=col,sticky='wens') tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10) rw+=1 col=0 fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr] fr.grid(row=rw,column=col,sticky='wens') tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10) col+=1 fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr] fr.grid(row=rw,column=col,sticky='wens') tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10) col+=1 rw+=1 col=0 fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr] fr.grid(row=rw,column=col,sticky='wens') tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10) col+=1 fr = tk.Frame(root,borderwidth =1,relief = 'groove');frames+=[fr] fr.grid(row=rw,column=col,sticky='wens') tk.Button(fr,text='button (%d,%d)'%(rw,col)).pack(padx=10,pady=10) col+=1 root.mainloop() Olivier From Cameron at phaseit.net Mon Jul 3 17:22:13 2006 From: Cameron at phaseit.net (Cameron Laird) Date: Mon, 3 Jul 2006 15:22:13 +0000 Subject: [Tkinter-discuss] Canvas pixels In-Reply-To: <20060701131927.GA4035@unpythonic.net> References: <2849.69.146.105.32.1151724684.squirrel@findyourcore.com> <20060701131927.GA4035@unpythonic.net> Message-ID: <20060703152213.GA5303@lairds.us> On Sat, Jul 01, 2006 at 08:19:29AM -0500, Jeff Epler wrote: . . . > > is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas? > > No, tk doesn't provide a way to do this. . . . True. This annoyed me so much, though, that I researched it a tiny bit more. The Img extension, as it happens, can snapshot a canvas into a photo, and Tkinter itself can report on the pixel values in a photo image. That's as good as it gets, apparently. What I don't know is whether Tkinter supports Img at all; I must confess that I'm only aware of its availability for Tcl/Tk. From jepler at unpythonic.net Mon Jul 3 22:04:16 2006 From: jepler at unpythonic.net (Jeff Epler) Date: Mon, 3 Jul 2006 15:04:16 -0500 Subject: [Tkinter-discuss] grid sticky problem In-Reply-To: <44A928AB.5090502@gmail.com> References: <44A928AB.5090502@gmail.com> Message-ID: <20060703200414.GA9177@unpythonic.net> You need to give some rows or columns nonzero weight. master.grid_rowconfigure(rownum, weight=1) master.grid.columconfigure(colnum, weight=1) Jeff From klappnase at web.de Mon Jul 3 23:37:57 2006 From: klappnase at web.de (Michael Lange) Date: Mon, 3 Jul 2006 23:37:57 +0200 Subject: [Tkinter-discuss] Canvas pixels In-Reply-To: <20060703152213.GA5303@lairds.us> References: <2849.69.146.105.32.1151724684.squirrel@findyourcore.com> <20060701131927.GA4035@unpythonic.net> <20060703152213.GA5303@lairds.us> Message-ID: <20060703233757.1eb75413.klappnase@web.de> On Mon, 3 Jul 2006 15:22:13 +0000 Cameron Laird wrote: > On Sat, Jul 01, 2006 at 08:19:29AM -0500, Jeff Epler wrote: > . > . > . > > > is there a way to get the RGB color, pixel by pixel, of a tkinter.Canvas? > > > > No, tk doesn't provide a way to do this. > . > . > . > True. > > This annoyed me so much, though, that I researched it a tiny > bit more. The Img extension, as it happens, can snapshot a > canvas into a photo, and Tkinter itself can report on the > pixel values in a photo image. > > That's as good as it gets, apparently. What I don't know is > whether Tkinter supports Img at all; I must confess that I'm > only aware of its availability for Tcl/Tk. Do you mean the tkImg library from ? If so, I have used it successfully by just adding a line root.tk.call('package', 'require', 'Img') (where root of course is my Tk() window). I have only used it for displaying .png images though, I don't know about this "snapshot" feature. Michael From jkuo22 at yahoo.com.tw Tue Jul 4 05:12:45 2006 From: jkuo22 at yahoo.com.tw (jkuo) Date: Tue, 4 Jul 2006 11:12:45 +0800 (CST) Subject: [Tkinter-discuss] simple script -Tkinter question. Message-ID: <20060704031245.61135.qmail@web53203.mail.yahoo.com> Hi everyone, Here is my simple Tkinter script: ## start of entry.py from Tkinter import * root=Tk() e1=Entry(root, width=16) e1.pack() e2=Entry(root, width=16) e2.pack() mainloop() ## end First, it works on win2k. When I run it as 'python entry.py' on linux, both 'e1' and 'e2' appear perfectly except I cannot enter any character in 'e1' entry, but 'e2' entry is ok. Second, when I run it in python interactive shell LINE BY LINE, then 'e1' and 'e2' entry both can accept user input, no problem! But when I copy and paste it into interactive shell, then the first situation happens again. So..., has anyone ever run into this problem like me? and how do you fix it? I use python2.3.4 now. Thank you! jkuo ___________________________________________________ 最新版 Yahoo!奇摩即時通訊 7.0,免費網路電話任你打! http://messenger.yahoo.com.tw/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060704/37eb8980/attachment.html From mkieverpy at tlink.de Tue Jul 4 09:48:44 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Tue, 4 Jul 2006 09:48:44 +0200 Subject: [Tkinter-discuss] simple script -Tkinter question. Message-ID: <44aa1d5c1b55e0.15936825@> Hi jkuo! >Hi everyone, >Here is my simple Tkinter script: >## start of entry.py >from Tkinter import * >root=Tk() >e1=Entry(root, width=16) >e1.pack() >e2=Entry(root, width=16) >e2.pack() >mainloop() >## end You should call 'root.mainloop()'! Just mainloop() is the mainloop of Tcl, not Tk. I don't know what the effects of this might be. On Linux everything seems to work, nonetheless. Hope this helps, Matthias Kievernagel mkiever/at/web/dot/de software development From klappnase at web.de Tue Jul 4 11:59:10 2006 From: klappnase at web.de (Michael Lange) Date: Tue, 4 Jul 2006 11:59:10 +0200 Subject: [Tkinter-discuss] simple script -Tkinter question. In-Reply-To: <44aa1d5c1b55e0.15936825@> References: <44aa1d5c1b55e0.15936825@> Message-ID: <20060704115910.2297dcf9.klappnase@web.de> On Tue, 4 Jul 2006 09:48:44 +0200 mkieverpy at tlink.de wrote: > Hi jkuo! > > >Hi everyone, > >Here is my simple Tkinter script: > > >## start of entry.py > >from Tkinter import * > >root=Tk() > >e1=Entry(root, width=16) > >e1.pack() > >e2=Entry(root, width=16) > >e2.pack() > >mainloop() > >## end > > You should call 'root.mainloop()'! > Just mainloop() is the mainloop of Tcl, not Tk. > I don't know what the effects of this might be. > On Linux everything seems to work, nonetheless. > Really? From Tkinter.py it looks to me like it should be equivalent: def mainloop(n=0): """Run the main loop of Tcl.""" _default_root.tk.mainloop(n) (...snip...) class Tk(Misc, Wm): """Toplevel widget of Tk which represents mostly the main window of an appliation. It has an associated Tcl interpreter.""" _w = '.' def __init__(self, screenName=None, baseName=None, className='Tk'): global _default_root (...snip...) if _support_default_root and not _default_root: _default_root = self so _default_root is the Tk() instance. Unfortunately this does not explain what is going wrong in the example. Michael From mkieverpy at tlink.de Tue Jul 4 13:16:40 2006 From: mkieverpy at tlink.de (mkieverpy at tlink.de) Date: Tue, 4 Jul 2006 13:16:40 +0200 Subject: [Tkinter-discuss] simple script -Tkinter question. Message-ID: <44aa4e185797a9.07695962@> Michael Lange wrote: >Really? From Tkinter.py it looks to me like it should be equivalent: > >def mainloop(n=0): >"""Run the main loop of Tcl.""" >_default_root.tk.mainloop(n) > >(...snip...) I trusted the documentation :-(. So I thought this to be the cause of this strange behaviour. Otherwise I have no idea (I'm not doing a lot of windows). Matthias Kievernagel mkiever/at/web/dot/de software development From pdfernhout at kurtz-fernhout.com Thu Jul 6 16:12:02 2006 From: pdfernhout at kurtz-fernhout.com (Paul D. Fernhout) Date: Thu, 06 Jul 2006 10:12:02 -0400 Subject: [Tkinter-discuss] PataPata as a Tkinter-based GUI designer Message-ID: <44AD1A32.6060109@kurtz-fernhout.com> Version 0.2.02 of PataPata has just been released on SourceForge. PataPata is an experiment about making a live Python object environment of Prototypes and Morphs. It is intended mainly to support building educational simulations and other microworlds for informal "constructivist" education and "unschooling". It has previously been discussed on the edusig list, but perhaps some people here might also find it of interest for the Tkinter-related aspects. The primary GUI interface is currently written in TK/Tkinter, and supports interactively building TK-related projects (though only ones under the GPL for now). My focus on Tkinter at this point is mainly for easy installability, although the value of the TK library has been growing on me as I use it more. Almost two years ago, Eric Brunel posted this comment on Tkinter GUI building: http://www.codecomments.com/archive284-2004-10-305528.html and I think the PataPata approach might potentially address the issues he raises there on the need for better Tkinter GUI designer which can support a wide range of widgets for multiple TK-related libraries. Basically, as part of a larger effort to bring some of the more dynamic qualities of Self and Squeak to Python, PataPata brings "prototypes" with "properties" (beyond the Python properties) to Python programming. This makes it easier to wrap arbitrary GUI components, whether existing Tkinter widgets, adding pure TCL/TK widgets (an example for that is included in the latest 0.2.02 for a combobox and tablelist), or, theoretically (as I haven't tried it yet), addign widgets from PMW, Tix, BWidgets, and so on. Or, in theory, and not at the same time as using TK widgets, even widgets from WX, GTK, or whatever could be wrapped. PataPata had an earlier and simpler WX GUI which has not been kept up-to-date, but used the same wrapping approach, providing some hopes for cross-platform GUIs. I know there are many efforts related to that kind of support already (AnyGUI, PyUI, etc.), of course, though I think they come at it from a different perspective, and their widgets could also in theory be wrapped in PataPata as well. Another included example wraps an "xturtle" widget (an advanced version of a 2D turtle by Gregor Lingl as a sophisticated library using Tkinter). There is still no way around doing some hand-coding wrapping work for each widget, but PataPata provides at least a framework for doing that work and for being able to get started with it easily to do some simple wrapping of a widget, and then add more wrapping as more functionality is needed. There is limited PythonCard compatibility as well, as I chose to use PythonCard naming conventions for access to many features of the Tkinter widgets. This limited compatibility may make it somewhat easier to port some simple PythonCard applications to Tkinter, though it still takes a bunch of work (one example of doing this for the PythonCard sample "conversions" is included) and many PythonCard widgets are not yet supported. But you can at least take a PythonCard resource file and convert it to PataPata if all the widgets types used are supported, as a start to then doing hand coding for the rest of the functionality (which is a tribute to PythonCard's modular design). Now there may well be other approaches to the issues Eric Brunel brought up, so this isn't to say PataPata is intended primarily to solve these issues, just that in addition to its main purpose of bringing to Python the notion of Prototypes and Morphs (that Squeak and Self have to varying degrees), PataPata also provides an approach to handling those other issues, which may be of interest to Tkinter users. Here is the project web site: http://sourceforge.net/projects/patapata/ Screenshots: http://sourceforge.net/project/screenshots.php?group_id=165910 A homepage with links to more information (including screencasts by Francois Schnell): http://patapata.sourceforge.net/ I had to resolve a few tricky Tkinter-related issues in the process, and the archives of this list were very useful, thanks. :-) Anyway, PataPata is still very much an experiment and work in progress, so this isn't intended to convince you to move all your Tkinter work in it, just to mention it as something being played with at the moment. There remain lots of things to do for it and lots of ways it can be improved (and probably some bugs too, of course. :-) --Paul Fernhout From bwmetz at att.com Fri Jul 7 00:16:30 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Thu, 6 Jul 2006 17:16:30 -0500 Subject: [Tkinter-discuss] Tkinter TopLevel transparency Message-ID: <01D5341D04A2E64AB9B3457690473367020D7C41@OCCLUST01EVS1.ugd.att.com> All, Looking for help on making my toplevel window backgrounds opaque or transparent. I've seen sparse mention of setting the alpha property of the toplevel, but the only other mention I've seen in any documentation has to do with canvas widgets. I'm running python 2.4 and the toplevel returns an error when I try to set the alpha param. >>> from Tkinter import * >>> root = Tk() >>> root.wm_attributes('-alpha', 0.5) Traceback (most recent call last): File "", line 1, in ? root.wm_attributes('alpha', 0.5) File "c:\python24\lib\lib-tk\Tkinter.py", line 1386, in wm_attributes return self.tk.call(args) TclError: wrong # args: should be "wm attributes window ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??" I first saw this referenced on effbot.org and was hoping to use it. http://effbot.org/tkinterbook/wm.htm In Win32 programming I know this is a two step process but haven't found any equiv documentation for Tkinter and using the Python win32 modules doesn't work as seen here for Notepad. import win32con import win32api import win32gui import winxpgui # Notepad window handle hWND = 1050292 # Prep the window for transparency...creates buffer of some sort in Windows win32gui.SetWindowLong (hWND, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (hWND, win32con.GWL_EXSTYLE ) | win32con.WS_EX_LAYERED ) # Get the window background color bgColor = win32api.GetSysColor(win32con.COLOR_WINDOW) r = bgColor & 0xFF g = (bgColor & 0x0000FF00) >> 8 b = (bgColor & 0x00FF0000) >> 16 # Re-compute the RGB value to pass to the SetLayeredWindowAttributes function winxpgui.SetLayeredWindowAttributes(hWND, win32api.RGB(r, g, b), 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA) Any pointers would be greatly appreciated! Thanks, Bobby From fuzzyman at voidspace.org.uk Sun Jul 9 02:30:38 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 09 Jul 2006 01:30:38 +0100 Subject: [Tkinter-discuss] Tkinter Menu Message-ID: <44B04E2E.2000203@voidspace.org.uk> Hello all, I want to dynamically re-arrange menus. If I store a reference to the top level menubar instance or the children cascades, how can I access members of the menu ? I would like to remove certain entries and then replace them 'in place' with others. I can currently do this by destroying the whole menubar and replacing it with a new one, but this seems over the top. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml From jepler at unpythonic.net Sun Jul 9 16:43:12 2006 From: jepler at unpythonic.net (Jeff Epler) Date: Sun, 9 Jul 2006 09:43:12 -0500 Subject: [Tkinter-discuss] Tkinter Menu In-Reply-To: <44B04E2E.2000203@voidspace.org.uk> References: <44B04E2E.2000203@voidspace.org.uk> Message-ID: <20060709144312.GB26951@unpythonic.net> .add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods you can use to incrementally change menus. If the menu is not a tearoff, the postcommand= may give you a good way to populate the menu when it is about to be shown, rather than anytime its contents would have changed. Jeff From fuzzyman at voidspace.org.uk Mon Jul 10 22:50:52 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Jul 2006 21:50:52 +0100 Subject: [Tkinter-discuss] Tkinter Menu In-Reply-To: <20060709144312.GB26951@unpythonic.net> References: <44B04E2E.2000203@voidspace.org.uk> <20060709144312.GB26951@unpythonic.net> Message-ID: <44B2BDAC.3030203@voidspace.org.uk> Jeff Epler wrote: > .add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods > you can use to incrementally change menus. If the menu is not a > tearoff, the postcommand= may give you a good way to populate the menu > when it is about to be shown, rather than anytime its contents would > have changed. > Thanks Jeff. I had a menu with x number of entries. I wanted to delete all the entries except the last two and then rebuild the amended entries. I couldn't find any way to determine the *number* of entries, or iterate over them. I ended up keeping a separate list of the entries and calling : menu.delete(0, numMenuItems - 1) followed by a series of inserts... All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Jeff > > From fuzzyman at voidspace.org.uk Mon Jul 10 22:54:59 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 10 Jul 2006 21:54:59 +0100 Subject: [Tkinter-discuss] Tkinter Menu In-Reply-To: <20060709144312.GB26951@unpythonic.net> References: <44B04E2E.2000203@voidspace.org.uk> <20060709144312.GB26951@unpythonic.net> Message-ID: <44B2BEA3.9060603@voidspace.org.uk> Jeff Epler wrote: > .add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods > you can use to incrementally change menus. If the menu is not a > tearoff, the postcommand= may give you a good way to populate the menu > when it is about to be shown, rather than anytime its contents would > have changed. > Thanks Jeff. I have a menu with x number of entries. I wanted to delete all the entries except the last two and then rebuild the amended entries. I couldn't find any way to determine the *number* of entries, or iterate over them. I ended up keeping a separate list of the entries and calling : menu.delete(0, numMenuItems - 1) followed by a series of inserts... It works, so I'm not worried. :-) All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Jeff > > From bwmetz at att.com Tue Jul 11 01:54:06 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Mon, 10 Jul 2006 18:54:06 -0500 Subject: [Tkinter-discuss] Tkinter Menu In-Reply-To: <44B2BEA3.9060603@voidspace.org.uk> Message-ID: <01D5341D04A2E64AB9B34576904733670213F467@OCCLUST01EVS1.ugd.att.com> Deleting is easiest using the index feature. In your case: if menu.index("last") is not None: menu.delete(0, menu.index("last") - 2) Bobby -----Original Message----- From: tkinter-discuss-bounces at python.org [mailto:tkinter-discuss-bounces at python.org]On Behalf Of Michael Foord Sent: Monday, July 10, 2006 1:55 PM To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Tkinter Menu Jeff Epler wrote: > .add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods > you can use to incrementally change menus. If the menu is not a > tearoff, the postcommand= may give you a good way to populate the menu > when it is about to be shown, rather than anytime its contents would > have changed. > Thanks Jeff. I have a menu with x number of entries. I wanted to delete all the entries except the last two and then rebuild the amended entries. I couldn't find any way to determine the *number* of entries, or iterate over them. I ended up keeping a separate list of the entries and calling : menu.delete(0, numMenuItems - 1) followed by a series of inserts... It works, so I'm not worried. :-) All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Jeff > > _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss From fuzzyman at voidspace.org.uk Tue Jul 11 11:19:54 2006 From: fuzzyman at voidspace.org.uk (Fuzzyman) Date: Tue, 11 Jul 2006 10:19:54 +0100 Subject: [Tkinter-discuss] Tkinter Menu In-Reply-To: <01D5341D04A2E64AB9B34576904733670213F467@OCCLUST01EVS1.ugd.att.com> References: <01D5341D04A2E64AB9B34576904733670213F467@OCCLUST01EVS1.ugd.att.com> Message-ID: <44B36D3A.5020202@voidspace.org.uk> Metz, Bobby W, WWCS wrote: >Deleting is easiest using the index feature. In your case: > >if menu.index("last") is not None: > menu.delete(0, menu.index("last") - 2) > > Cool, I didn't know you could do that. Thanks Fuzzyman http://www.voidspace.org.uk/python/index.shtml >Bobby > >-----Original Message----- >From: tkinter-discuss-bounces at python.org >[mailto:tkinter-discuss-bounces at python.org]On Behalf Of Michael Foord >Sent: Monday, July 10, 2006 1:55 PM >To: tkinter-discuss at python.org >Subject: Re: [Tkinter-discuss] Tkinter Menu > > >Jeff Epler wrote: > > >>.add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods >>you can use to incrementally change menus. If the menu is not a >>tearoff, the postcommand= may give you a good way to populate the menu >>when it is about to be shown, rather than anytime its contents would >>have changed. >> >> >> >Thanks Jeff. > >I have a menu with x number of entries. I wanted to delete all the >entries except the last two and then rebuild the amended entries. > >I couldn't find any way to determine the *number* of entries, or iterate > >over them. I ended up keeping a separate list of the entries and calling >: > >menu.delete(0, numMenuItems - 1) > >followed by a series of inserts... It works, so I'm not worried. :-) > >All the best, > >Fuzzyman >http://www.voidspace.org.uk/python/index.shtml > > >>Jeff >> >> >> >> > >_______________________________________________ >Tkinter-discuss mailing list >Tkinter-discuss at python.org >http://mail.python.org/mailman/listinfo/tkinter-discuss > > > From fuzzyman at voidspace.org.uk Tue Jul 11 14:07:20 2006 From: fuzzyman at voidspace.org.uk (Fuzzyman) Date: Tue, 11 Jul 2006 13:07:20 +0100 Subject: [Tkinter-discuss] System Font Size Message-ID: <44B39478.6020702@voidspace.org.uk> Hello all, I'm creating a windows application, with a Tkinter GUI. I currently happily set the font sizes using tuples ``font=("name", "size", "weight")``. (or something like that.) I use a couple of different sizes for titles, subtitles, body text and buttons. I would like to detect the system font size, so that I can respond to this. (In case the user has specified larger fonts). Does anyone know how I can do this ? Oh, and while I'm on the subject, does anyone know of a pure Python combobox other than the Pmw one ? The Pmw one is fine, it just means distributing the Pmw extension with my application, and if I could replace this with a single file I would. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml From jepler at unpythonic.net Tue Jul 11 16:54:20 2006 From: jepler at unpythonic.net (Jeff Epler) Date: Tue, 11 Jul 2006 09:54:20 -0500 Subject: [Tkinter-discuss] System Font Size In-Reply-To: <44B39478.6020702@voidspace.org.uk> References: <44B39478.6020702@voidspace.org.uk> Message-ID: <20060711145420.GD308@unpythonic.net> If you want to find the default font used for a particular item, create one and interrogate it: >>> b = Tkinter.Button(app) >>> b.cget("font") '-monotype-arial-medium-r-normal-*-12-*-*-*-p-*-iso8859-15' (in this case, it's a Linux system with the fonts coming from the X resource database in XLFD format) You can find out details of the font using the tkFont module: >>> import tkFont >>> f = tkFont.Font(b, b.cget("font")) >>> fo.metrics() {'fixed': 0, 'ascent': 11, 'descent': 3, 'linespace': 14} >>> fo.configure() {'family': 'arial', 'weight': 'normal', 'overstrike': '0', 'size': '9', 'slant': 'roman', 'underline': '0'} >>> fo.measure("Hello World") 64 You can construct a new font similar to an existing one: >>> fc = fo.configure() >>> fc.weight = 'bold' >>> nf = tkFont.Font(b, **fc) >>> b.configure(font=nf, text="Bold Button") >>> b.pack() You can also find the available "font families": >>> tkFont.families(b) ('nimbus roman no9 l', 'arial black', 'clearlyu devangari extra', ... I'm not sure what use this is: >>> tkFont.names(b) ('font136858972', 'font136997436') Jeff From fuzzyman at voidspace.org.uk Tue Jul 11 17:03:52 2006 From: fuzzyman at voidspace.org.uk (Fuzzyman) Date: Tue, 11 Jul 2006 16:03:52 +0100 Subject: [Tkinter-discuss] System Font Size In-Reply-To: <20060711145420.GD308@unpythonic.net> References: <44B39478.6020702@voidspace.org.uk> <20060711145420.GD308@unpythonic.net> Message-ID: <44B3BDD8.2020405@voidspace.org.uk> Jeff Epler wrote: >If you want to find the default font used for a particular item, create >one and interrogate it: > >>> b = Tkinter.Button(app) > >>> b.cget("font") > '-monotype-arial-medium-r-normal-*-12-*-*-*-p-*-iso8859-15' > > Wow, on windows I get : '{MS Sans Serif} 8' That's pretty different. :-) If I then change my system font size to "extra large" and repeat the exercise, the default font size is unchanged. The text on the title bar is made bigger, but buttons created have the same smaller size text. Looks like I'll have to find a win32 way to check the system settings. :-( Thanks anyway Jeff. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml >(in this case, it's a Linux system with the fonts coming from the X >resource database in XLFD format) > >You can find out details of the font using the tkFont module: > >>> import tkFont > >>> f = tkFont.Font(b, b.cget("font")) > >>> fo.metrics() > {'fixed': 0, 'ascent': 11, 'descent': 3, 'linespace': 14} > >>> fo.configure() > {'family': 'arial', 'weight': 'normal', 'overstrike': '0', 'size': '9', > 'slant': 'roman', 'underline': '0'} > >>> fo.measure("Hello World") > 64 > >You can construct a new font similar to an existing one: > >>> fc = fo.configure() > >>> fc.weight = 'bold' > >>> nf = tkFont.Font(b, **fc) > >>> b.configure(font=nf, text="Bold Button") > >>> b.pack() > >You can also find the available "font families": > >>> tkFont.families(b) > ('nimbus roman no9 l', 'arial black', 'clearlyu devangari extra', ... >I'm not sure what use this is: > >>> tkFont.names(b) > ('font136858972', 'font136997436') > >Jeff > > > From bwmetz at att.com Tue Jul 11 18:24:02 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Tue, 11 Jul 2006 11:24:02 -0500 Subject: [Tkinter-discuss] System Font Size In-Reply-To: <44B3BDD8.2020405@voidspace.org.uk> Message-ID: <01D5341D04A2E64AB9B34576904733670213F95F@OCCLUST01EVS1.ugd.att.com> Tk font sizes are independent of Windows so looking for a win32com means of querying the system font sizes may be required. As to your combobox question, I don't use pmw but the combobox should be fairly simple to create. To refresh my mem on it I looked up examples of the two types, simple & dropdown. The simple version would be pretty easy to do with a label and listbox. The dropdown version would be harder, but if you don't care about the arrow icon and don't need to select multiple items in the combobox dropdown, then an OptionMenu would be the way to go. Another thing to consider is tying a ListBox to a Button or MenuButton. I've never tried this but I believe I've seen others on the web say it can be done. Bobby -----Original Message----- From: tkinter-discuss-bounces at python.org [mailto:tkinter-discuss-bounces at python.org]On Behalf Of Fuzzyman Sent: Tuesday, July 11, 2006 8:04 AM To: Jeff Epler Cc: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] System Font Size Jeff Epler wrote: >If you want to find the default font used for a particular item, create >one and interrogate it: > >>> b = Tkinter.Button(app) > >>> b.cget("font") > '-monotype-arial-medium-r-normal-*-12-*-*-*-p-*-iso8859-15' > > Wow, on windows I get : '{MS Sans Serif} 8' That's pretty different. :-) If I then change my system font size to "extra large" and repeat the exercise, the default font size is unchanged. The text on the title bar is made bigger, but buttons created have the same smaller size text. Looks like I'll have to find a win32 way to check the system settings. :-( Thanks anyway Jeff. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml >(in this case, it's a Linux system with the fonts coming from the X >resource database in XLFD format) > >You can find out details of the font using the tkFont module: > >>> import tkFont > >>> f = tkFont.Font(b, b.cget("font")) > >>> fo.metrics() > {'fixed': 0, 'ascent': 11, 'descent': 3, 'linespace': 14} > >>> fo.configure() > {'family': 'arial', 'weight': 'normal', 'overstrike': '0', 'size': '9', > 'slant': 'roman', 'underline': '0'} > >>> fo.measure("Hello World") > 64 > >You can construct a new font similar to an existing one: > >>> fc = fo.configure() > >>> fc.weight = 'bold' > >>> nf = tkFont.Font(b, **fc) > >>> b.configure(font=nf, text="Bold Button") > >>> b.pack() > >You can also find the available "font families": > >>> tkFont.families(b) > ('nimbus roman no9 l', 'arial black', 'clearlyu devangari extra', ... >I'm not sure what use this is: > >>> tkFont.names(b) > ('font136858972', 'font136997436') > >Jeff > > > _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss From bwmetz at att.com Tue Jul 11 23:37:39 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Tue, 11 Jul 2006 16:37:39 -0500 Subject: [Tkinter-discuss] Tkinter Menu In-Reply-To: <44B36D3A.5020202@voidspace.org.uk> Message-ID: <01D5341D04A2E64AB9B34576904733670213FEF1@OCCLUST01EVS1.ugd.att.com> yeh, you won't find it in a lot of tkinter references...at least my initial queries for such a feature turned up squat months ago. The "end" word should work as well, but I've always used "last". Bobby -----Original Message----- From: Fuzzyman [mailto:fuzzyman at voidspace.org.uk] Sent: Tuesday, July 11, 2006 2:20 AM To: Metz, Bobby W, WWCS Cc: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Tkinter Menu Metz, Bobby W, WWCS wrote: >Deleting is easiest using the index feature. In your case: > >if menu.index("last") is not None: > menu.delete(0, menu.index("last") - 2) > > Cool, I didn't know you could do that. Thanks Fuzzyman http://www.voidspace.org.uk/python/index.shtml >Bobby > >-----Original Message----- >From: tkinter-discuss-bounces at python.org >[mailto:tkinter-discuss-bounces at python.org]On Behalf Of Michael Foord >Sent: Monday, July 10, 2006 1:55 PM >To: tkinter-discuss at python.org >Subject: Re: [Tkinter-discuss] Tkinter Menu > > >Jeff Epler wrote: > > >>.add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods >>you can use to incrementally change menus. If the menu is not a >>tearoff, the postcommand= may give you a good way to populate the menu >>when it is about to be shown, rather than anytime its contents would >>have changed. >> >> >> >Thanks Jeff. > >I have a menu with x number of entries. I wanted to delete all the >entries except the last two and then rebuild the amended entries. > >I couldn't find any way to determine the *number* of entries, or iterate > >over them. I ended up keeping a separate list of the entries and calling >: > >menu.delete(0, numMenuItems - 1) > >followed by a series of inserts... It works, so I'm not worried. :-) > >All the best, > >Fuzzyman >http://www.voidspace.org.uk/python/index.shtml > > >>Jeff >> >> >> >> > >_______________________________________________ >Tkinter-discuss mailing list >Tkinter-discuss at python.org >http://mail.python.org/mailman/listinfo/tkinter-discuss > > > From klappnase at web.de Wed Jul 12 23:00:57 2006 From: klappnase at web.de (Michael Lange) Date: Wed, 12 Jul 2006 23:00:57 +0200 Subject: [Tkinter-discuss] Tix.Grid wrapper Message-ID: <20060712230057.1090c844.klappnase@web.de> Hi all, just for fun I wrote a wrapper for the Tix.Grid and Tix.ScrolledGrid widgets. You can find it at: www.8ung.at/klappnase/TixGrid/TixGrid.html . The zip-file includes a short test script with code examples and most of the methods and options are documented in the source. Although some of the tixGrid commands seem to have no effect (and due to the poor tix documentation I could not figure out the use of some commands) it may be not too bad at least for simple table display tasks. If anyone has a use for it, it would be nice, if you would report your experience with it here. Maybe after some more testing it could be something to contribute. Regards Michael From fredrik at pythonware.com Wed Jul 12 23:36:26 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 12 Jul 2006 23:36:26 +0200 Subject: [Tkinter-discuss] System Font Size In-Reply-To: <44B39478.6020702@voidspace.org.uk> References: <44B39478.6020702@voidspace.org.uk> Message-ID: Fuzzyman wrote: > Oh, and while I'm on the subject, does anyone know of a pure Python > combobox other than the Pmw one ? The Pmw one is fine, it just means > distributing the Pmw extension with my application, and if I could > replace this with a single file I would. here's an old module that might be useful: http://svn.effbot.python-hosting.com/stuff/sandbox/tkinter/tkComboChooser.py From mike at pcblokes.com Wed Jul 12 23:56:16 2006 From: mike at pcblokes.com (Michael Foord) Date: Wed, 12 Jul 2006 22:56:16 +0100 Subject: [Tkinter-discuss] System Font Size In-Reply-To: References: <44B39478.6020702@voidspace.org.uk> Message-ID: <44B57000.3040203@pcblokes.com> Fredrik Lundh wrote: > Fuzzyman wrote: > > >> Oh, and while I'm on the subject, does anyone know of a pure Python >> combobox other than the Pmw one ? The Pmw one is fine, it just means >> distributing the Pmw extension with my application, and if I could >> replace this with a single file I would. >> > > here's an old module that might be useful: > > http://svn.effbot.python-hosting.com/stuff/sandbox/tkinter/tkComboChooser.py > > Aargh... I've just integrated the Pmw one, but this looks like it might be easier for me to customise. Thanks, now I have to *think* and I don't like that. Fuzzyman http://www.voidspace.org.uk/python/index.shtml > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > > From fredrik at pythonware.com Thu Jul 13 19:52:36 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 13 Jul 2006 19:52:36 +0200 Subject: [Tkinter-discuss] System Font Size In-Reply-To: <44B57000.3040203@pcblokes.com> References: <44B39478.6020702@voidspace.org.uk> <44B57000.3040203@pcblokes.com> Message-ID: Michael Foord wrote: > Thanks, now I have to *think* and I don't like that. sooooooooooooooooooooooooooooooooooooooooooooooorry! (in case anyone wonders, the above was the shortest spelling that didn't result in a single google hit) From fuzzyman at voidspace.org.uk Thu Jul 13 23:07:13 2006 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 13 Jul 2006 22:07:13 +0100 Subject: [Tkinter-discuss] Tkinter DnD - Drag and Drop Message-ID: <44B6B601.1090405@voidspace.org.uk> Hello all, There is a Tcl/Tk package called tkDnD with a Python wrapper called TkinterDnD, which allow drag and drop operations with a Tkinter GUI. http://sourceforge.net/projects/tkdnd http://www.8ung.at/klappnase/TkinterDnD/TkinterDnD.html This should allow you to create callbacks for files dropped onto Tkinter windows, something I am keen to do. It looks like the TkinterDnD package is designed to be used with the older version 1 of tkDnD. It also looks like this doesn't work with Python 2.4. I can get the tkDnD package (v1) installed into the Tcl package that comes with Python (for Windows XP SP2). The TkinterDnD demo runs, and icons appear when you drag files over the windows. However the callbacks don't happen. Does anyone have any success in getting any combination of these packages working with Python 2.4 and windows ? All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml From mike at pcblokes.com Thu Jul 13 23:25:40 2006 From: mike at pcblokes.com (Michael Foord) Date: Thu, 13 Jul 2006 22:25:40 +0100 Subject: [Tkinter-discuss] Tkinter DnD - Drag and Drop Message-ID: <44B6BA54.3080206@pcblokes.com> Hello all, There is a Tcl/Tk package called tkDnD with a Python wrapper called TkinterDnD, which allow drag and drop operations with a Tkinter GUI. http://sourceforge.net/projects/tkdnd http://www.8ung.at/klappnase/TkinterDnD/TkinterDnD.html This should allow you to create callbacks for files dropped onto Tkinter windows, something I am keen to do. It looks like the TkinterDnD package is designed to be used with the older version 1 of tkDnD. It also looks like this doesn't work with Python 2.4. I can get the tkDnD package (v1) installed into the Tcl package that comes with Python (for Windows XP SP2). The TkinterDnD demo runs, and icons appear when you drag files over the windows. However the callbacks don't happen. Does anyone have any success in getting any combination of these packages working with Python 2.4 and windows ? All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml From klappnase at web.de Fri Jul 14 15:09:04 2006 From: klappnase at web.de (Michael Lange) Date: Fri, 14 Jul 2006 15:09:04 +0200 Subject: [Tkinter-discuss] Tkinter DnD - Drag and Drop In-Reply-To: <44B6BA54.3080206@pcblokes.com> References: <44B6BA54.3080206@pcblokes.com> Message-ID: <20060714150904.5b6c828a.klappnase@web.de> On Thu, 13 Jul 2006 22:25:40 +0100 Michael Foord wrote: > Hello all, > > There is a Tcl/Tk package called tkDnD with a Python wrapper called > TkinterDnD, which allow drag and drop operations with a Tkinter GUI. > > http://sourceforge.net/projects/tkdnd > http://www.8ung.at/klappnase/TkinterDnD/TkinterDnD.html > > This should allow you to create callbacks for files dropped onto Tkinter > windows, something I am keen to do. > > It looks like the TkinterDnD package is designed to be used with the > older version 1 of tkDnD. It also looks like this doesn't work with > Python 2.4. > > I can get the tkDnD package (v1) installed into the Tcl package that > comes with Python (for Windows XP SP2). The TkinterDnD demo runs, and > icons appear when you drag files over the windows. However the callbacks > don't happen. > > Does anyone have any success in getting any combination of these > packages working with Python 2.4 and windows ? > > All the best, Hi Michael, I made the same observations. Maybe the problem is that the tkdnd binary is built against an older version of Tcl/Tk. I currently don't have a windows box running, so I planned to wait until the unix part of tkdnd2 is fully implemented before I start updating the TkinterDnD module. The author of tkdnd wrote at http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/37c43ef2aeb2de18/d2d03a79b955f3d4?lnk=st&q=tkdnd&rnum=8 that tkdnd2 has a compatibility layer for tkdnd1-code, so maybe you could try to use tkdnd2 and see how far you get (I have not tried this so far). Michael From mike at pcblokes.com Mon Jul 17 15:19:04 2006 From: mike at pcblokes.com (Michael Foord) Date: Mon, 17 Jul 2006 14:19:04 +0100 Subject: [Tkinter-discuss] Tkinter DnD - Drag and Drop In-Reply-To: <20060714150904.5b6c828a.klappnase@web.de> References: <44B6BA54.3080206@pcblokes.com> <20060714150904.5b6c828a.klappnase@web.de> Message-ID: <44BB8E48.4040404@pcblokes.com> Michael Lange wrote: > On Thu, 13 Jul 2006 22:25:40 +0100 > Michael Foord wrote: > > >> Hello all, >> >> There is a Tcl/Tk package called tkDnD with a Python wrapper called >> TkinterDnD, which allow drag and drop operations with a Tkinter GUI. >> >> http://sourceforge.net/projects/tkdnd >> http://www.8ung.at/klappnase/TkinterDnD/TkinterDnD.html >> >> This should allow you to create callbacks for files dropped onto Tkinter >> windows, something I am keen to do. >> >> It looks like the TkinterDnD package is designed to be used with the >> older version 1 of tkDnD. It also looks like this doesn't work with >> Python 2.4. >> >> I can get the tkDnD package (v1) installed into the Tcl package that >> comes with Python (for Windows XP SP2). The TkinterDnD demo runs, and >> icons appear when you drag files over the windows. However the callbacks >> don't happen. >> >> Does anyone have any success in getting any combination of these >> packages working with Python 2.4 and windows ? >> >> All the best, >> > > Hi Michael, > > I made the same observations. Maybe the problem is that the tkdnd binary is built against an > older version of Tcl/Tk. I currently don't have a windows box running, so I planned to wait > until the unix part of tkdnd2 is fully implemented before I start updating the TkinterDnD module. > The author of tkdnd wrote at > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/37c43ef2aeb2de18/d2d03a79b955f3d4?lnk=st&q=tkdnd&rnum=8 > that tkdnd2 has a compatibility layer for tkdnd1-code, > so maybe you could try to use tkdnd2 and see how far you get (I have not tried this so far). > Thanks for the reply. Unfortunately it didn't work (for me) when I tried it with tkdnd2. I will have to wait for the update to TkinterDnD. :-) Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Michael > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > > From klappnase at web.de Wed Jul 19 11:55:11 2006 From: klappnase at web.de (Michael Lange) Date: Wed, 19 Jul 2006 11:55:11 +0200 Subject: [Tkinter-discuss] Tkinter DnD - Drag and Drop In-Reply-To: <44BB8E48.4040404@pcblokes.com> References: <44B6BA54.3080206@pcblokes.com> <20060714150904.5b6c828a.klappnase@web.de> <44BB8E48.4040404@pcblokes.com> Message-ID: <20060719115511.4bf95dc6.klappnase@web.de> On Mon, 17 Jul 2006 14:19:04 +0100 Michael Foord wrote: > > > > I made the same observations. Maybe the problem is that the tkdnd binary is built against an > > older version of Tcl/Tk. I currently don't have a windows box running, so I planned to wait > > until the unix part of tkdnd2 is fully implemented before I start updating the TkinterDnD module. > > The author of tkdnd wrote at > > http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/37c43ef2aeb2de18/d2d03a79b955f3d4?lnk=st&q=tkdnd&rnum=8 > > that tkdnd2 has a compatibility layer for tkdnd1-code, > > so maybe you could try to use tkdnd2 and see how far you get (I have not tried this so far). > > > Thanks for the reply. > > Unfortunately it didn't work (for me) when I tried it with tkdnd2. > > I will have to wait for the update to TkinterDnD. :-) > Hi Michael, now I became curios, and started wrapping tkdnd2.0 . The Python interface looks good to me, however I could not manage to get everything working. On windows dropping files from Explorer works, dragging operations seem to start but I cannot seem to figure out how to successfully finish them. On linux nothing seems to work. I think that probably the problem is not the wrapper, but the usage; the tkdnd2.0 man page is buggy and maybe not complete. If you want to try it anyway, you can find it at: http://www.8ung.at/klappnase/TkinterDnD2/TkinterDnD2.html , and if you do so, please do not forget to report your experience;-) Regards Michael From mike at pcblokes.com Wed Jul 19 14:53:45 2006 From: mike at pcblokes.com (Michael Foord) Date: Wed, 19 Jul 2006 13:53:45 +0100 Subject: [Tkinter-discuss] Tkinter DnD - Drag and Drop In-Reply-To: <20060719115511.4bf95dc6.klappnase@web.de> References: <44B6BA54.3080206@pcblokes.com> <20060714150904.5b6c828a.klappnase@web.de> <44BB8E48.4040404@pcblokes.com> <20060719115511.4bf95dc6.klappnase@web.de> Message-ID: <44BE2B59.4060306@pcblokes.com> Michael Lange wrote: > On Mon, 17 Jul 2006 14:19:04 +0100 > Michael Foord wrote: > > >>> I made the same observations. Maybe the problem is that the tkdnd binary is built against an >>> older version of Tcl/Tk. I currently don't have a windows box running, so I planned to wait >>> until the unix part of tkdnd2 is fully implemented before I start updating the TkinterDnD module. >>> The author of tkdnd wrote at >>> http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/37c43ef2aeb2de18/d2d03a79b955f3d4?lnk=st&q=tkdnd&rnum=8 >>> that tkdnd2 has a compatibility layer for tkdnd1-code, >>> so maybe you could try to use tkdnd2 and see how far you get (I have not tried this so far). >>> >>> >> Thanks for the reply. >> >> Unfortunately it didn't work (for me) when I tried it with tkdnd2. >> >> I will have to wait for the update to TkinterDnD. :-) >> >> > > Hi Michael, > > now I became curios, and started wrapping tkdnd2.0 . > The Python interface looks good to me, however I could not manage to get everything working. > On windows dropping files from Explorer works, dragging operations seem to start but I cannot seem to > figure out how to successfully finish them. > On linux nothing seems to work. > I think that probably the problem is not the wrapper, but the usage; the tkdnd2.0 man page is buggy and maybe > not complete. > If you want to try it anyway, you can find it at: > > http://www.8ung.at/klappnase/TkinterDnD2/TkinterDnD2.html > > , and if you do so, please do not forget to report your experience;-) > > I certainly will do. All I need is dropping, so I will see how that goes and report back. Thanks Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Regards > > Michael > > > > > From geon at post.cz Sun Jul 23 16:50:44 2006 From: geon at post.cz (Pavel Kosina) Date: Sun, 23 Jul 2006 16:50:44 +0200 Subject: [Tkinter-discuss] slow moving on Canvas Message-ID: <44C38CC4.8090809@post.cz> I got two similar programs- one in Livewires and one in Tkinter. Just moving the player on a canvas. Why is that one in Tkinter so slow? What did I miss? Livewires is based on Tkinter, so it should be the same. I looked at the code of Livewires, tried something, but no success. Maybe its because of sleeping part in event handler in Tkinter, that is somehow (how?) bypassed in Livewires by magic tkinter.dooneevent(tkinter.DONT_WAIT). Neither this worked with me. Could anyone help? Both programs attached. -- geon Pavel Kosina -------------- next part -------------- A non-text attachment was scrubbed... Name: robotsTk.py Type: text/x-python Size: 808 bytes Desc: not available Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20060723/6d66356c/attachment.py -------------- next part -------------- A non-text attachment was scrubbed... Name: robotsLivewires.py Type: text/x-python Size: 746 bytes Desc: not available Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20060723/6d66356c/attachment-0001.py From Vasilis.Vlachoudis at cern.ch Thu Jul 27 20:16:19 2006 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 27 Jul 2006 20:16:19 +0200 Subject: [Tkinter-discuss] MouseWheel bug in cygwin Message-ID: <70AC93E40E95FB41BF3CA043B7A249AF02438526@cernxchg01.cern.ch> Hi All, The following program works nicely with windows Python, but it crashes with no any information under cygwin Regards Vasilis from Tkinter import * root = Tk() canvas = Canvas(root) canvas.pack(side=TOP, expand=YES, fill=BOTH) for i in range(1000): canvas.create_text(10, i*20, text="Hello world %d" % (i), anchor=NW) def wheel(event): print "wheel" canvas.yview(SCROLL, -event.delta//120, UNITS) canvas.focus_set() canvas.bind('', wheel) #canvas.bind('<4>', lambda e : canvas.yview(SCROLL, -1, UNITS)) #canvas.bind('<5>', lambda e : canvas.yview(SCROLL, 1, UNITS)) root.mainloop() -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20060727/51c38df4/attachment.html