From bob at passcal.nmt.edu Wed May 6 17:57:03 2009 From: bob at passcal.nmt.edu (Bob Greschke) Date: Wed, 6 May 2009 09:57:03 -0600 Subject: [Tkinter-discuss] Canvas create_line dropping pixels Message-ID: <8D08D366-B36F-42F1-9610-2ED8100C2BE3@passcal.nmt.edu> I'm trying to draw letters and numbers (need rotated text without using PMW and all the other solutions I've seen), but create_line drops pixels at the ends of the lines it draws. Sometimes the beginning pixel is missing and sometimes the end pixel. Is there a work around other than the obvious of extending the the line an extra pixel where necessary? It does this on old Suns, new Macs and Windows (except different pixels are missing between the different OSs). PIL had this problem a while back, but it was fixed with v1.1.6. Like this should be a small "+" sign, but it is missing the end pixels on both lines (and just making the "+" bigger doesn't seem to help. Can.create_line((Xx-1, Yy-1, Xx+1, Yy-1), fill = "white") Can.create_line((Xx, Yy-2, Xx, Yy), fill = "white") I've fiddled with the capstyle/joinstyle/arrow options, but haven't come up with anything. Thanks! Bob From xsxcn at hotmail.com Thu May 14 09:18:56 2009 From: xsxcn at hotmail.com (Protosssword) Date: Thu, 14 May 2009 15:18:56 +0800 Subject: [Tkinter-discuss] Can tkinter handle an animation containing 10, 000 2d disks? Message-ID: Dear Colleagues, I am considering using python to write a simulation program to display the motions of about 10,000 2d disks. The program doesn't need to calculate the positions of disks. It just reads the result file and displays disks on the screen. I wonder whether Tkinter has this ability for rendering so many disks in time. Thanks! Shengxu Xia _________________________________________________________________ Messenger??????????????????Messenger??? http://im.live.cn/safe/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Thu May 14 17:11:13 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Thu, 14 May 2009 17:11:13 +0200 Subject: [Tkinter-discuss] Can tkinter handle an animation containing 10, 000 2d disks? In-Reply-To: References: Message-ID: <47e491110905140811o7dd84229q60244f7e77379831@mail.gmail.com> See below code which moves 10,000 small disks (6x6 pixels) around a canvas 1000x1000 pixels, without regard to stacking order (no z axis for disk positions), and moving disks randomly +-1 in the x and y axis each iteration: Takes about 1 second per iteration on my old slow windoze box: from Tkinter import * from random import randint class MyCanv(Canvas): def setup(self, diskCount): self.wgts=[] for i in range(diskCount): x=randint(0,1000) y=randint(0,1000) wid=canv.create_oval(x, y, x+6, y+6, fill="blue") self.wgts.append((wid, x, y)) while True: self.update1() def update1(self): newItems=[] for item,x,y in self.wgts: xdiff=randint(-1,1) ydiff=randint(-1,1) newx=x+xdiff newy=y+ydiff if newx<0 or newx>1000: xdiff=0 newx=x if newy<0 or newy>1000: ydiff=0 newy=y self.move(item, xdiff, ydiff) newItems.append((item,newx, newy)) self.wgts=newItems self.update() main=Tk() canv=MyCanv(main, bg="white", height=1000, width=1000) Button(main, text="Start", command=lambda c=canv: c.setup(10000)).pack() canv.pack(side=TOP) main.mainloop() 2009/5/14 Protosssword : > Dear Colleagues, > > I am considering using python to write a simulation program to display the > motions of about 10,000 2d disks. The program doesn't need to calculate the > positions of disks. It just reads the result file and displays disks on the > screen. I wonder whether Tkinter has this ability for rendering so many > disks in time. > > Thanks! > > > Shengxu Xia > > ________________________________ > ????? Windows Live Messenger ???????? ????? > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From michael.odonnell at uam.es Thu May 14 17:46:29 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Thu, 14 May 2009 17:46:29 +0200 Subject: [Tkinter-discuss] Can tkinter handle an animation containing 10, 000 2d disks? In-Reply-To: References: Message-ID: <47e491110905140846p4e3d6811k6196251aed65e410@mail.gmail.com> See below code which moves 10,000 small disks (6x6 pixels) around a canvas 1000x1000 pixels, without regard to stacking order (no z axis for disk positions), and moving disks randomly +-1 in the x and y axis each iteration: Takes about 1 second per iteration on my old slow windoze box: from Tkinter import * from random import randint class MyCanv(Canvas): def setup(self, diskCount): self.wgts=[] for i in range(diskCount): x=randint(0,1000) y=randint(0,1000) wid=canv.create_oval(x, y, x+6, y+6, fill="blue") self.wgts.append((wid, x, y)) while True: self.update1() def update1(self): newItems=[] for item,x,y in self.wgts: xdiff=randint(-1,1) ydiff=randint(-1,1) newx=x+xdiff newy=y+ydiff if newx<0 or newx>1000: xdiff=0 newx=x if newy<0 or newy>1000: ydiff=0 newy=y self.move(item, xdiff, ydiff) newItems.append((item,newx, newy)) self.wgts=newItems self.update() main=Tk() canv=MyCanv(main, bg="white", height=1000, width=1000) Button(main, text="Start", command=lambda c=canv: c.setup(10000)).pack() canv.pack(side=TOP) main.mainloop() 2009/5/14 Protosssword : > Dear Colleagues, > > I am considering using python to write a simulation program to display the > motions of about 10,000 2d disks. The program doesn't need to calculate the > positions of disks. It just reads the result file and displays disks on the > screen. I wonder whether Tkinter has this ability for rendering so many > disks in time. > > Thanks! > > > Shengxu Xia > > ________________________________ > ????? Windows Live Messenger ???????? ????? > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From michael.odonnell at uam.es Thu May 14 17:52:53 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Thu, 14 May 2009 17:52:53 +0200 Subject: [Tkinter-discuss] Can tkinter handle an animation containing 10, 000 2d disks? In-Reply-To: References: Message-ID: <47e491110905140852i791bdac8neaaed2cff604a755@mail.gmail.com> See below code which moves 10,000 small disks (6x6 pixels) around a canvas 1000x1000 pixels, without regard to stacking order (no z axis for disk positions), and moving disks randomly +-1 in the x and y axis each iteration: Takes about 1 second per iteration on my old slow windoze box: from Tkinter import * from random import randint class MyCanv(Canvas): def setup(self, diskCount): self.wgts=[] for i in range(diskCount): x=randint(0,1000) y=randint(0,1000) wid=canv.create_oval(x, y, x+6, y+6, fill="blue") self.wgts.append((wid, x, y)) while True: self.update1() def update1(self): newItems=[] for item,x,y in self.wgts: xdiff=randint(-1,1) ydiff=randint(-1,1) newx=x+xdiff newy=y+ydiff if newx<0 or newx>1000: xdiff=0 newx=x if newy<0 or newy>1000: ydiff=0 newy=y self.move(item, xdiff, ydiff) newItems.append((item,newx, newy)) self.wgts=newItems self.update() main=Tk() canv=MyCanv(main, bg="white", height=1000, width=1000) Button(main, text="Start", command=lambda c=canv: c.setup(10000)).pack() canv.pack(side=TOP) main.mainloop() 2009/5/14 Protosssword : > Dear Colleagues, > > I am considering using python to write a simulation program to display the > motions of about 10,000 2d disks. The program doesn't need to calculate the > positions of disks. It just reads the result file and displays disks on the > screen. I wonder whether Tkinter has this ability for rendering so many > disks in time. > > Thanks! > > > Shengxu Xia > > ________________________________ > ????? Windows Live Messenger ???????? ????? > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From michael.odonnell at uam.es Fri May 15 08:44:27 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Fri, 15 May 2009 08:44:27 +0200 Subject: [Tkinter-discuss] Can tkinter handle an animation containing 10, 000 2d disks? In-Reply-To: <47e491110905140852i791bdac8neaaed2cff604a755@mail.gmail.com> References: <47e491110905140852i791bdac8neaaed2cff604a755@mail.gmail.com> Message-ID: <47e491110905142344p521b739bhf1027d046e799a54@mail.gmail.com> Excuse the multiple posts yesterday. Gmail was playing up, saying it coulnd't send, when in fact it had. Mick 2009/5/14 Michael O'Donnell : > See below code which moves 10,000 small disks (6x6 pixels) > around a canvas 1000x1000 pixels, without regard to stacking order > (no z axis for disk positions), and moving disks randomly +-1 in > the x and y axis each iteration: > > Takes about 1 second per iteration on my old slow windoze box: > > from Tkinter import * > from random import randint > > class MyCanv(Canvas): > > def setup(self, diskCount): > self.wgts=[] > for i in range(diskCount): > x=randint(0,1000) > y=randint(0,1000) > wid=canv.create_oval(x, y, x+6, y+6, fill="blue") > self.wgts.append((wid, x, y)) > > while True: > self.update1() > > def update1(self): > newItems=[] > for item,x,y in self.wgts: > xdiff=randint(-1,1) > ydiff=randint(-1,1) > newx=x+xdiff > newy=y+ydiff > if newx<0 or newx>1000: > xdiff=0 > newx=x > if newy<0 or newy>1000: > ydiff=0 > newy=y > self.move(item, xdiff, ydiff) > newItems.append((item,newx, newy)) > self.wgts=newItems > self.update() > > main=Tk() > canv=MyCanv(main, bg="white", height=1000, width=1000) > Button(main, text="Start", command=lambda c=canv: c.setup(10000)).pack() > canv.pack(side=TOP) > main.mainloop() > > > > 2009/5/14 Protosssword : >> Dear Colleagues, >> >> I am considering using python to write a simulation program to display the >> motions of about 10,000 2d disks. The program doesn't need to calculate the >> positions of disks. It just reads the result file and displays disks on the >> screen. I wonder whether Tkinter has this ability for rendering so many >> disks in time. >> >> Thanks! >> >> >> Shengxu Xia >> >> ________________________________ >> ????? Windows Live Messenger ???????? ????? >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> > From sampath at venlabs.net Mon May 18 07:26:23 2009 From: sampath at venlabs.net (Sampath Girish M) Date: Mon, 18 May 2009 10:56:23 +0530 Subject: [Tkinter-discuss] Fwd: Hi Problem regarding Pmw and py2exe In-Reply-To: <60e8f3180905172224t19216aebice6bb129ef9b31ec@mail.gmail.com> References: <60e8f3180905172224t19216aebice6bb129ef9b31ec@mail.gmail.com> Message-ID: <60e8f3180905172226o42521076wbd3ec8ba14bf30c2@mail.gmail.com> ---------- Forwarded message ---------- From: Sampath Girish M Date: Mon, May 18, 2009 at 10:54 AM Subject: Fwd: Hi Problem regarding Pmw and py2exe To: bangpypers at python.org ---------- Forwarded message ---------- From: Date: Mon, May 18, 2009 at 10:53 AM Subject: Hi Problem regarding Pmw and py2exe To: sampath at venlabs.net Hi, This is member-only group. You need to be a member to post to this group. Your message has been rejected, since you are not a member. If you want to post to this list, please subscribe to the list. The homepage of the list is, http://mail.python.org/mailman/listinfo/bangpypers/ Thank you and hope to see you back at BangPypers! Regards, List Moderator(s) ---------- Forwarded message ---------- From: Sampath Girish M To: bangpypers at python.org Date: Mon, 18 May 2009 10:53:04 +0530 Subject: Hi Problem regarding Pmw and py2exe Hi guys, I am a python learner. My name is Sampath Girish M. I have a problem with Pmw toolkit during py2exe conversion process. Traceback (most recent call last): File "C:\Python25\Pmw.1.3.2\src\Pmw\__init__.py", line 29, in _dir = __path__[0] NameError: name '__path__' is not defined This is the error i got when i ran the file __init__.py file. WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Python25\\dist\\library.zip\\Pmw/*.*' Traceback (most recent call last): File "login1.py", line 6, in File "home1.pyc", line 8, in File "tabbed_inv.pyc", line 11, in File "Pmw\__init__.pyc", line 28, in WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Python25\\dist\\library.zip\\Pmw/*.*' I got the above error in Pmw to py2exe process. Please give me a solution or anyone's mailing list. So that problem solving probability will be more. Thanks and Regards, Sampath Girish Munagala, -- Regards, Sampath Girish Munagala, Programmer Trainee, VENLABS PVT LTD., VISAKHAPATNAM -- Regards, Sampath Girish Munagala, Programmer Trainee, VENLABS PVT LTD., VISAKHAPATNAM -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.giesen at kodak.com Mon May 18 15:54:41 2009 From: david.giesen at kodak.com (david.giesen at kodak.com) Date: Mon, 18 May 2009 09:54:41 -0400 Subject: [Tkinter-discuss] Hi Problem regarding Pmw and py2exe In-Reply-To: Message-ID: Check the step 2 listed at this page. It describes how to get PMW and py2exe working together. http://larc.ee.nthu.edu.tw/~lmdenq/doc/py2exe.html Please let us know how that works out for you - Dave David J. Giesen | Research Scientist | FPEG US Display OLED Materials R+D | Eastman Kodak Company | 2/83/KRL MC02216 | Rochester, NY 14650 | david.giesen at kodak.com | 1-585-588-0480 Office | www.kodak.com > ---------- Forwarded message ---------- > From: Sampath Girish M > To: bangpypers at python.org > Date: Mon, 18 May 2009 10:53:04 +0530 > Subject: Hi Problem regarding Pmw and py2exe > Hi guys, > I am a python learner. My name is Sampath Girish M. I have a > problem with Pmw toolkit during py2exe conversion process. > Traceback (most recent call last): > File "C:\Python25\Pmw.1.3.2\src\Pmw\__init__.py", line 29, in > _dir = __path__[0] > NameError: name '__path__' is not defined > > This is the error i got when i ran the file __init__.py file. > > WindowsError: [Error 3] The system cannot find the path specified: > 'C:\\Python25\\dist\\library.zip\\Pmw/*.*' > Traceback (most recent call last): > File "login1.py", line 6, in > File "home1.pyc", line 8, in > File "tabbed_inv.pyc", line 11, in > File "Pmw\__init__.pyc", line 28, in > WindowsError: [Error 3] The system cannot find the path specified: > 'C:\\Python25\\dist\\library.zip\\Pmw/*.*' > > I got the above error in Pmw to py2exe process. Please give me a solution or > anyone's mailing list. So that problem solving probability will be more. > > > > Thanks and Regards, > Sampath Girish Munagala, > > > > > > -- > Regards, > Sampath Girish Munagala, > Programmer Trainee, > VENLABS PVT LTD., > VISAKHAPATNAM > > > > -- > Regards, > Sampath Girish Munagala, > Programmer Trainee, > VENLABS PVT LTD., > VISAKHAPATNAM > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: discuss/attachments/20090518/a3127a8b/attachment-0001.htm> > > ------------------------------ > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > End of Tkinter-discuss Digest, Vol 63, Issue 5 > ********************************************** From larry.ogorman at alcatel-lucent.com Wed May 20 00:08:03 2009 From: larry.ogorman at alcatel-lucent.com (O'Gorman, Lawrence (Larry)) Date: Tue, 19 May 2009 17:08:03 -0500 Subject: [Tkinter-discuss] non-GUI event detection in Tkinter mainloop() Message-ID: I'm trying to figure out if Python and Tkinter can offer a solution to my following problem. I want to monitor a file and when that file is changed, I want to detect that event and have my window change its text from "File Unchanged" to "File has Changed." That is, I can produce a function to periodically sample the modification time of a file and if it is different than my last sample time, then this function will return an indication that the file is changed. I want this file-change event to be captured by the tkinit mainloop(), which I will then use to change the appearance of my window. I understand that any GUI event (mouse, keyboard, etc.) can be detected in the mainloop(), but I have seen no indication in the documentation and discussions that a file-change can produce an event that can be detected in the mainloop(). Does anyone know if I can do this? If so, how? Or, if there is an alternative way than mainloop() to get a window to change upon a file-change, that would be helpful, too. -------------- next part -------------- An HTML attachment was scrubbed... URL: From igor.e.novikov at gmail.com Wed May 20 11:25:08 2009 From: igor.e.novikov at gmail.com (Igor Novikov) Date: Wed, 20 May 2009 12:25:08 +0300 Subject: [Tkinter-discuss] non-GUI event detection in Tkinter mainloop() In-Reply-To: References: Message-ID: <23f7fc190905200225u15fe151bg9c9369552e494327@mail.gmail.com> Hi Lawrence, File system events are not a part of tk library so Tkinter doesn't process such events. Nevertheless native _tkinter library contains two file event related procedures - createfilehandler() and deletefilehandler() So you can try finding samples how to use these functions. For example: http://mail.python.org/pipermail/python-list/1999-May/001838.html Also you can try resolving this issue using "fileevent" tcl command: http://www.tcl.tk/man/tcl8.5/TclCmd/fileevent.htm But this way supposes tcl programming. Regards, Igor Novikov sK1 Project http://sk1project.org On Wed, May 20, 2009 at 1:08 AM, O'Gorman, Lawrence (Larry) < larry.ogorman at alcatel-lucent.com> wrote: > I?m trying to figure out if Python and Tkinter can offer a solution to my > following problem. I want to monitor a file and when that file is changed, I > want to detect that event and have my window change its text from ?File > Unchanged? to ?File has Changed.? > > > > That is, I can produce a function to periodically sample the modification > time of a file and if it is different than my last sample time, then this > function will return an indication that the file is changed. I want this > file-change event to be captured by the tkinit mainloop(), which I will then > use to change the appearance of my window. > > > > I understand that any GUI event (mouse, keyboard, etc.) can be detected in > the mainloop(), but I have seen no indication in the documentation and > discussions that a file-change can produce an event that can be detected in > the mainloop(). Does anyone know if I can do this? If so, how? Or, if there > is an alternative way than mainloop() to get a window to change upon a > file-change, that would be helpful, too. > > _______________________________________________ > 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 msa01 at bitflipper.ca Wed May 20 04:35:32 2009 From: msa01 at bitflipper.ca (Cam Farnell) Date: Tue, 19 May 2009 23:35:32 -0300 Subject: [Tkinter-discuss] non-GUI event detection in Tkinter mainloop() In-Reply-To: References: Message-ID: <4A136C74.7010208@bitflipper.ca> The only way I know of to do this is to use "after" to invoke a function which does the file checking and whatever else is required. That function sets another "after" - with perhaps a one second delay or whatever seems appropriate - to invoke itself. Thus the function is invoked repeatedly to keep track of the file. It isn't pretty but it works. Cam Farnell O'Gorman, Lawrence (Larry) wrote: > I?m trying to figure out if Python and Tkinter can offer a solution to > my following problem. I want to monitor a file and when that file is > changed, I want to detect that event and have my window change its text > from ?File Unchanged? to ?File has Changed.? > > > > That is, I can produce a function to periodically sample the > modification time of a file and if it is different than my last sample > time, then this function will return an indication that the file is > changed. I want this file-change event to be captured by the tkinit > mainloop(), which I will then use to change the appearance of my window. > > > > I understand that any GUI event (mouse, keyboard, etc.) can be detected > in the mainloop(), but I have seen no indication in the documentation > and discussions that a file-change can produce an event that can be > detected in the mainloop(). Does anyone know if I can do this? If so, > how? Or, if there is an alternative way than mainloop() to get a window > to change upon a file-change, that would be helpful, too. From Cameron at phaseit.net Wed May 20 18:33:06 2009 From: Cameron at phaseit.net (Cameron Laird) Date: Wed, 20 May 2009 16:33:06 +0000 Subject: [Tkinter-discuss] non-GUI event detection in Tkinter mainloop() In-Reply-To: <23f7fc190905200225u15fe151bg9c9369552e494327@mail.gmail.com> References: <23f7fc190905200225u15fe151bg9c9369552e494327@mail.gmail.com> Message-ID: <20090520163306.GA3997@lairds.us> On Wed, May 20, 2009 at 12:25:08PM +0300, Igor Novikov wrote: . . . > File system events are not a part of tk library so Tkinter doesn't process > such events. > Nevertheless native _tkinter library contains two file event related > procedures - createfilehandler() and deletefilehandler() > So you can try finding samples how to use these functions. For example: > > http://mail.python.org/pipermail/python-list/1999-May/001838.html > > Also you can try resolving this issue using "fileevent" tcl command: > > http://www.tcl.tk/man/tcl8.5/TclCmd/fileevent.htm > > But this way supposes tcl programming. . . . There are arguably easier ways. It might be the weekend before I can explain. My summary: Mr. O'Gorman can try Mr. Novikov's sug- gestions, OR wait for the possibility of a more completed approach. From igor.e.novikov at gmail.com Wed May 20 19:11:20 2009 From: igor.e.novikov at gmail.com (Igor Novikov) Date: Wed, 20 May 2009 20:11:20 +0300 Subject: [Tkinter-discuss] non-GUI event detection in Tkinter mainloop() In-Reply-To: <20090520163306.GA3997@lairds.us> References: <23f7fc190905200225u15fe151bg9c9369552e494327@mail.gmail.com> <20090520163306.GA3997@lairds.us> Message-ID: <23f7fc190905201011s66571060ubaf9452156ca3ddd@mail.gmail.com> Yes, you are right. Solution without Tkinter usage is also possible. File watcher can be created on pure Python implementation: http://www.amk.ca/python/simple/dirwatch.html Sorry I forgot this issue because this thread is a [Tkinter-discuss] :) Regards, Igor Novikov sK1 Project http://sk1project.org On Wed, May 20, 2009 at 7:33 PM, Cameron Laird wrote: > On Wed, May 20, 2009 at 12:25:08PM +0300, Igor Novikov wrote: > . > . > . > > File system events are not a part of tk library so Tkinter doesn't > process > > such events. > > Nevertheless native _tkinter library contains two file event related > > procedures - createfilehandler() and deletefilehandler() > > So you can try finding samples how to use these functions. For example: > > > > http://mail.python.org/pipermail/python-list/1999-May/001838.html > > > > Also you can try resolving this issue using "fileevent" tcl command: > > > > http://www.tcl.tk/man/tcl8.5/TclCmd/fileevent.htm > > > > But this way supposes tcl programming. > . > . > . > There are arguably easier ways. It might be the weekend before I > can explain. My summary: Mr. O'Gorman can try Mr. Novikov's sug- > gestions, OR wait for the possibility of a more completed approach. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From larry.ogorman at alcatel-lucent.com Thu May 21 21:00:57 2009 From: larry.ogorman at alcatel-lucent.com (O'Gorman, Lawrence (Larry)) Date: Thu, 21 May 2009 14:00:57 -0500 Subject: [Tkinter-discuss] non-GUI event detection in Tkinter mainloop() Message-ID: Thanks very much to all those who responded to me and thanks to my good buddy and Python wiz, Kirke. I've included my code below, which periodically checks if a file is changed, and if so, it changes the image displayed in a window. The trick (as suggested) was to use "after" to get the event to repeatedly call itself. In the code below this is showStatus.after() at the end of the checkFileMod() function. -- import Tkinter import os root = Tkinter.Tk() # initialize parameters checkFile = "C:/BTL/Code/GC/IPSi/test3.txt" # check if this file changed img1=Tkinter.PhotoImage(file='./img1.gif') # display image 1 img2=Tkinter.PhotoImage(file='./img2.gif') # display image 2 interval = 3000 # time [msec] between checking # label widget shows status of image being displayed showStatus = Tkinter.Label() showStatus.pack() # canvas widget displays image that changes when file changes canvas=Tkinter.Canvas(root, width=400, height=400) canvas.create_image(145,280, image=img1) canvas.bind("", quitThis) # bind left mouse button to quit app canvas.pack() # function quits application def quitThis(event): canvas.destroy() root.destroy() root.quit() # function changes canvas if file is modified def checkFileMod(): global imgNum global fileStatus, fileStatusB4 fileStatus = os.stat(checkFile) print "file status: ", fileStatus.st_mtime if fileStatus != fileStatusB4: print "CHANGED" if imgNum == 1: showStatus.config(text="img2") imgNum = 2 canvas.create_image(145,280, image=img2) canvas.pack() else: showStatus.config(text="img1") imgNum = 1 canvas.create_image(145,280, image=img1) canvas.pack() fileStatusB4 = fileStatus showStatus.after(interval, checkFileMod) # run with initial values before loop imgNum = 1 showStatus.config(text="img1") fileStatusB4 = os.stat(checkFile) # file status before #loop checkFileMod() showStatus.mainloop() -------------- next part -------------- An HTML attachment was scrubbed... URL: From oc-spam66 at laposte.net Sun May 24 00:17:47 2009 From: oc-spam66 at laposte.net (oc-spam66) Date: Sun, 24 May 2009 00:17:47 +0200 (CEST) Subject: [Tkinter-discuss] copy-enabled Label Message-ID: <25005754.53572.1243117067536.JavaMail.www@wwinf8217> Hello, my application displays the result of a calculation in a Label. I would like the user to be able to copy this result somewhere else. I don't know how to enable this. I read on a mailing list that I could use a state=DISABLED Entry widget, but this doesn't work (I can't select anything with the mouse when it is DISABLED). I also found some complicated tcl/tk code which I did not understand. How to do ? I think a copy-enabled Label is a must. Best regards, O.C. Cr?ez votre adresse ?lectronique prenom.nom at laposte.net 1 Go d'espace de stockage, anti-spam et anti-virus int?gr?s. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Sun May 24 10:30:03 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Sun, 24 May 2009 10:30:03 +0200 Subject: [Tkinter-discuss] copy-enabled Label In-Reply-To: <25005754.53572.1243117067536.JavaMail.www@wwinf8217> References: <25005754.53572.1243117067536.JavaMail.www@wwinf8217> Message-ID: <47e491110905240130l21e472easa0b3ebdbb3d9c6fc@mail.gmail.com> Hi O.C. The following code shows how to use an Entry widget which ignores all key presses except Control-c and Control-x (copy and cut at least under windows). from Tkinter import * def copy1(event): pass def printKey(event): return "break" main=Tk() wt=Entry(main, bg="white") wt.insert(END, "FRed") wt.pack(side=LEFT, fill=BOTH,expand=True) wt.bind("", copy1) wt.bind("", copy1) wt.bind("", printKey) main.mainloop() On Sun, May 24, 2009 at 12:17 AM, oc-spam66 wrote: > Hello, > > my application displays the result of a calculation in a Label. I would like > the user to be able to copy this result somewhere else. I don't know how to > enable this. > > I read on a mailing list that I could use a state=DISABLED Entry widget, but > this doesn't work (I can't select anything with the mouse when it is > DISABLED). > I also found some complicated tcl/tk code which I did not understand. > > How to do ? I think a copy-enabled Label is a must. > > Best regards, > > O.C. > > > Cr?ez votre adresse ?lectronique prenom.nom at laposte.net > 1 Go d'espace de stockage, anti-spam et anti-virus int?gr?s. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From klappnase at web.de Sun May 24 13:57:39 2009 From: klappnase at web.de (Michael Lange) Date: Sun, 24 May 2009 13:57:39 +0200 Subject: [Tkinter-discuss] copy-enabled Label In-Reply-To: <47e491110905240130l21e472easa0b3ebdbb3d9c6fc@mail.gmail.com> References: <25005754.53572.1243117067536.JavaMail.www@wwinf8217> <47e491110905240130l21e472easa0b3ebdbb3d9c6fc@mail.gmail.com> Message-ID: <20090524135739.ab135b6e.klappnase@web.de> Hi, On Sun, 24 May 2009 10:30:03 +0200 "Michael O'Donnell" wrote: > Hi O.C. > > The following code shows how to use an Entry widget > which ignores all key presses except Control-c and Control-x > (copy and cut at least under windows). > > from Tkinter import * > > def copy1(event): > pass > > def printKey(event): > return "break" > > main=Tk() > > wt=Entry(main, bg="white") > wt.insert(END, "FRed") > wt.pack(side=LEFT, fill=BOTH,expand=True) > wt.bind("", copy1) > wt.bind("", copy1) > wt.bind("", printKey) > main.mainloop() > > The copy-enabled label should be much easier to implement: >>> from Tkinter import * >>> root = Tk() >>> e=Entry(root,relief='flat',bd=0,takefocus=0,highlightthickness=0) >>> e.pack() >>> e.insert('end', 'foobar') >>> e.config(state='readonly') Regards Michael From michael.odonnell at uam.es Sun May 24 15:49:19 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Sun, 24 May 2009 15:49:19 +0200 Subject: [Tkinter-discuss] copy-enabled Label In-Reply-To: <20090524135739.ab135b6e.klappnase@web.de> References: <25005754.53572.1243117067536.JavaMail.www@wwinf8217> <47e491110905240130l21e472easa0b3ebdbb3d9c6fc@mail.gmail.com> <20090524135739.ab135b6e.klappnase@web.de> Message-ID: <47e491110905240649p2780ecc4h704030127c243458@mail.gmail.com> Hi Michael, Ahhh, my tkinter manual does not contain the state='readonly' property. Seems I need to update my manual (John Shipman's from 2003). The original poster should note that every time you want to change the text displayed, you need to change the state to normal, change the text, and then re-assert state='readonly'. Mick On Sun, May 24, 2009 at 1:57 PM, Michael Lange wrote: > Hi, > > On Sun, 24 May 2009 10:30:03 +0200 > "Michael O'Donnell" wrote: > >> Hi O.C. >> >> The following code shows how to use an Entry widget >> which ignores all key presses except Control-c and Control-x >> (copy and cut at least under windows). >> >> from Tkinter import * >> >> def copy1(event): >> ? ? pass >> >> def printKey(event): >> ? ? return "break" >> >> main=Tk() >> >> wt=Entry(main, bg="white") >> wt.insert(END, "FRed") >> wt.pack(side=LEFT, fill=BOTH,expand=True) >> wt.bind("", copy1) >> wt.bind("", copy1) >> wt.bind("", printKey) >> main.mainloop() >> >> > > The copy-enabled label should be much easier to implement: > >>>> from Tkinter import * >>>> root = Tk() >>>> e=Entry(root,relief='flat',bd=0,takefocus=0,highlightthickness=0) >>>> e.pack() >>>> e.insert('end', 'foobar') >>>> e.config(state='readonly') > > Regards > > Michael > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From kkk-mmm at 163.com Mon May 25 04:35:21 2009 From: kkk-mmm at 163.com (bobo) Date: Mon, 25 May 2009 10:35:21 +0800 (CST) Subject: [Tkinter-discuss] Bwidget to EXE Message-ID: <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> Hi I tried to complie my python script into exe file for running on Windows, and I have tried py2exe and pyinstaller. Both of them notice this kind of problem. It seem they don't support bwidget. I am running Python 2.5.4 with pybwidget 0.1.2. Could anyone can help with me? Thank you very much. Run: xxx....in __init__ xxx....in _require_tkinter.TclError: can't find package BWidget Complie: W: __all__ is built strangely at line 0 - bwidget (D:\python25\lib\site-packages\bwidget\__init__.pyc) -------------- next part -------------- An HTML attachment was scrubbed... URL: From oc-spam66 at laposte.net Mon May 25 23:04:19 2009 From: oc-spam66 at laposte.net (oc-spam66) Date: Mon, 25 May 2009 23:04:19 +0200 (CEST) Subject: [Tkinter-discuss] copy-enabled Label Message-ID: <21566516.38307.1243285459164.JavaMail.www@wwinf8216> Hello, @?Michael Lange : thank you for the keyword : state='readonly'. This is what I needed. It doesn't show in any of the general documentation I had on Tkinter, but it is indeed in the Tk man page of the "Entry" widget. @?Michael O'Donnell : > The original poster should note that every time you want to change > the text displayed, you need to change the state to normal, change the > text, and then re-assert state='readonly'. In fact I am using a "textvariable" link, so I don't need to do this. Regards, O.C. Cr?ez votre adresse ?lectronique prenom.nom at laposte.net 1 Go d'espace de stockage, anti-spam et anti-virus int?gr?s. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Mon May 25 23:33:21 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 25 May 2009 17:33:21 -0400 Subject: [Tkinter-discuss] Bwidget to EXE In-Reply-To: <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> References: <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> Message-ID: <4A1B0EA1.4000202@codebykevin.com> bobo wrote: > Hi I tried to complie my python script into exe file for running on Windows, and I have tried py2exe and pyinstaller. Both of them notice this kind of problem. It seem they don't support bwidget. I am running Python 2.5.4 with pybwidget 0.1.2. Could anyone can help with me? Thank you very much. > You also need the Tcl BWidgets package. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From kkk-mmm at 163.com Tue May 26 02:40:09 2009 From: kkk-mmm at 163.com (bobo) Date: Tue, 26 May 2009 08:40:09 +0800 (CST) Subject: [Tkinter-discuss] Bwidget to EXE In-Reply-To: <4A1B0EA1.4000202@codebykevin.com> References: <4A1B0EA1.4000202@codebykevin.com> <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> Message-ID: <4135669.40561243298409246.JavaMail.coremail@app159.163.com> Yes, I have had the BWidget-1.8.0 for Tcl, but I don't know how to install it or put them somewhere. Could you explain it more clearer? Thank you so much. >bobo wrote: >> Hi I tried to complie my python script into exe file for running on Windows, and I have tried py2exe and pyinstaller. Both of them notice this kind of problem. It seem they don't support bwidget. I am running Python 2.5.4 with pybwidget 0.1.2. Could anyone can help with me? Thank you very much. >> > >You also need the Tcl BWidgets package. > >-- >Kevin Walzer >Code by Kevin >http://www.codebykevin.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Tue May 26 03:15:28 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 25 May 2009 21:15:28 -0400 Subject: [Tkinter-discuss] Bwidget to EXE In-Reply-To: <4135669.40561243298409246.JavaMail.coremail@app159.163.com> References: <4A1B0EA1.4000202@codebykevin.com> <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> <4135669.40561243298409246.JavaMail.coremail@app159.163.com> Message-ID: <4A1B42B0.1050506@codebykevin.com> bobo wrote: > Yes, I have had the BWidget-1.8.0 for Tcl, but I don't know how to install it or put them somewhere. Could you explain it more clearer? Thank you so much. > > You'll need to include it somehow with the Tcl/Tk libaries that you wrap with py2exe. Not sure how that works since I don't develop on Windows. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From kkk-mmm at 163.com Tue May 26 03:58:25 2009 From: kkk-mmm at 163.com (bobo) Date: Tue, 26 May 2009 09:58:25 +0800 (CST) Subject: [Tkinter-discuss] Bwidget to EXE In-Reply-To: <4A1B42B0.1050506@codebykevin.com> References: <4A1B42B0.1050506@codebykevin.com> <4A1B0EA1.4000202@codebykevin.com> <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> <4135669.40561243298409246.JavaMail.coremail@app159.163.com> Message-ID: <9095066.108691243303105048.JavaMail.coremail@bj163app83.163.com> OK, I will try it now. Thank you for you suggestion! >bobo wrote: >> Yes, I have had the BWidget-1.8.0 for Tcl, but I don't know how to install it or put them somewhere. Could you explain it more clearer? Thank you so much. >> >> >You'll need to include it somehow with the Tcl/Tk libaries that you wrap >with py2exe. Not sure how that works since I don't develop on Windows. > >-- >Kevin Walzer >Code by Kevin >http://www.codebykevin.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at passcal.nmt.edu Tue May 26 18:31:26 2009 From: bob at passcal.nmt.edu (Bob Greschke) Date: Tue, 26 May 2009 10:31:26 -0600 Subject: [Tkinter-discuss] Adding to a Listbox Message-ID: I'd like to add (i.e. use the Command key on a Mac) event handling to a Listbox so that it behaves just like the "built-in" behavior (selecting/deselecting individual items when the selectmode is EXTENDED). What should the bind statement call to do that? Can it be done through something like an option_add so it applies to all listboxes in an application? Thanks! Bob From klappnase at web.de Tue May 26 20:23:53 2009 From: klappnase at web.de (Michael Lange) Date: Tue, 26 May 2009 20:23:53 +0200 Subject: [Tkinter-discuss] Adding to a Listbox In-Reply-To: References: Message-ID: <20090526202353.7b7f01c8.klappnase@web.de> Hi Bob, On Tue, 26 May 2009 10:31:26 -0600 Bob Greschke wrote: > I'd like to add (i.e. use the Command key on a > Mac) event handling to a Listbox so that it behaves just like the > "built-in" behavior (selecting/deselecting > individual items when the selectmode is EXTENDED). What should the > bind statement call to do that? Can it be done through something > like an option_add so it applies to all listboxes in an application? > I think root = Tk() root.bind_class('Listbox', '', root.bind_class('Listbox', '') ) should do the trick. Regards Michael > Thanks! > > Bob > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From kkk-mmm at 163.com Wed May 27 08:16:44 2009 From: kkk-mmm at 163.com (bobo) Date: Wed, 27 May 2009 14:16:44 +0800 (CST) Subject: [Tkinter-discuss] Bwidget to EXE In-Reply-To: <8ea88a240905261336h39226be2q5acf8ecc5bb3cdf9@mail.gmail.com> References: <8ea88a240905261336h39226be2q5acf8ecc5bb3cdf9@mail.gmail.com> <4A1B0EA1.4000202@codebykevin.com> <13914540.146631243218921469.JavaMail.coremail@bj163app83.163.com> <4135669.40561243298409246.JavaMail.coremail@app159.163.com> <4A1B42B0.1050506@codebykevin.com> <9095066.108691243303105048.JavaMail.coremail@bj163app83.163.com> Message-ID: <1330927.283041243405004553.JavaMail.coremail@bj163app32.163.com> I have kicked out this problem. The main problem comes from a segment of bwidget __init__.py code: _datadir = os.path.join(sys.prefix, "share", "pybwidget") It means the path of bwidget main modules. And it exsits in my d:\python25\ . So I copy this folder into my current exe folder, then everything runs well. By the way I have test it with both py2exe and pyinstaller. Thank you all of you!! ?2009-05-27?"Bobby Metz" ??? I haven't done py2exe work in years, but as I recall I never had any issues with installed Python modules except when my code's import statements were incorrect or missing. Now homemade modules were a different story. To get py2exe to recognize them I would use the sys.path.append command to include the sub-dir in which I stored my custom modules within the project. Example: sys.path.append("./modules") Perhaps this would help you if all else fails. Regards, Bobby 2009/5/25 bobo OK, I will try it now. Thank you for you suggestion! >bobo wrote: >> Yes, I have had the BWidget-1.8.0 for Tcl, but I don't know how to install it or put them somewhere. Could you explain it more clearer? Thank you so much. >> >> >You'll need to include it somehow with the Tcl/Tk libaries that you wrap >with py2exe. Not sure how that works since I don't develop on Windows. > >-- >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 -------------- next part -------------- An HTML attachment was scrubbed... URL: