From charras at me.com Tue Jun 1 04:30:38 2010 From: charras at me.com (Guido Carballo-Guerrero) Date: Mon, 31 May 2010 20:30:38 -0600 Subject: [Tkinter-discuss] How can I change the font in a heading using treeview Message-ID: <7E977586-C7CE-4A50-85ED-C0CDE1A4F0CA@me.com> Hello; Can somebody tell me how can I change the font size in the headings of a treeview table. I could change the fonts color and size of the data inside of the table, but I haven't been able to change the heading's font. Guido From nulla.epistola at web.de Tue Jun 1 16:43:53 2010 From: nulla.epistola at web.de (Sibylle Koczian) Date: Tue, 1 Jun 2010 16:43:53 +0200 (CEST) Subject: [Tkinter-discuss] Using listvariable in listbox - how? Message-ID: <865821287.125263.1275403433140.JavaMail.fmail@mwmweb036> ___________________________________________________________ NEU: WEB.DE DSL f?r 19,99 EUR/mtl. und ohne Mindest-Laufzeit! http://produkte.web.de/go/02/ From nulla.epistola at web.de Tue Jun 1 16:52:26 2010 From: nulla.epistola at web.de (Sibylle Koczian) Date: Tue, 1 Jun 2010 16:52:26 +0200 (CEST) Subject: [Tkinter-discuss] Using listvariable in listbox - how? Message-ID: <558001651.130175.1275403946999.JavaMail.fmail@mwmweb036> An HTML attachment was scrubbed... URL: From Gary.Scorby at harlandfs.com Tue Jun 1 17:15:31 2010 From: Gary.Scorby at harlandfs.com (Gary Scorby) Date: Tue, 1 Jun 2010 08:15:31 -0700 Subject: [Tkinter-discuss] OptionMenu text justification In-Reply-To: <4C02F0C5.30800@velseis.com.au> References: <35060D8B9453294F98923B7F6FAA2DAD0AA70A33@pdx-srv-ex1.harlandfs.com> <4C02F0C5.30800@velseis.com.au> Message-ID: <35060D8B9453294F98923B7F6FAA2DAD0AA70A40@pdx-srv-ex1.harlandfs.com> I guess I didn't explain this very well. I attempting to use Tkinter OptionMenu as a dropdown list. After picking the desired text in the dropdown list the text is centered in the window. I would like it to be left justified. Nothing I have tried has been successful. I am not talking about the label. I am not talking about text entered by hand. I am talking about the text in the dropdown list after a selection is made from that list. Thanks Gary -----Original Message----- From: John McMonagle [mailto:jmcmonagle at velseis.com] Sent: Sunday, May 30, 2010 4:12 PM To: Gary Scorby Cc: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] OptionMenu text justification Gary Scorby wrote: > I?m new to Tkinter. I need a drop down box to display a selection list > to an end user. It appears the best option for this is ?OptionMenu? (If > not, please suggest other options). I have it working like we want > except for one thing, after selecting something from the list and > closing the list, the text is centered in the window. We have some very > long lines of text to choose from. When the choice is made we would > like the chosen text to be left justified in the window. I?ve tried > ever option I can find, but the text remains centered. Any assistance > will be appreciated. > > In what widget are you displaying the text ? Label, Entry, Text ? For example, the following code displays two labels with varying lengths of text, aligned to the left: from Tkinter import * r = Tk() t1 = 'Short text' t2 = 'Long line of meaningless text to illustrate problem' l1 = Label(r, text=t1) l2 = Label(r, text=t2) l1.pack(anchor=W) l2.pack(anchor=W) r.mainloop() Now, if you wish to restrict the text to some horizontal distance and keep it left justified, you would use wraplength=distance, justify=LEFT as extra options to the Label widget. I hope this provides some assistance. Regards, John From klappnase at web.de Tue Jun 1 19:05:10 2010 From: klappnase at web.de (Michael Lange) Date: Tue, 1 Jun 2010 19:05:10 +0200 Subject: [Tkinter-discuss] OptionMenu text justification In-Reply-To: <35060D8B9453294F98923B7F6FAA2DAD0AA70A40@pdx-srv-ex1.harlandfs.com> References: <35060D8B9453294F98923B7F6FAA2DAD0AA70A33@pdx-srv-ex1.harlandfs.com> <4C02F0C5.30800@velseis.com.au> <35060D8B9453294F98923B7F6FAA2DAD0AA70A40@pdx-srv-ex1.harlandfs.com> Message-ID: <20100601190510.d2bd0581.klappnase@web.de> Hi Gary, On Tue, 1 Jun 2010 08:15:31 -0700 Gary Scorby wrote: > I guess I didn't explain this very well. > > I attempting to use Tkinter OptionMenu as a dropdown list. After > picking the desired text in the dropdown list the text is centered in > the window. I would like it to be left justified. Nothing I have > tried has been successful. I am not talking about the label. I am > not talking about text entered by hand. I am talking about the text > in the dropdown list after a selection is made from that list. > Maybe option_menu.configure(anchor='w') does what you want? Here this puts all the widget's text to the left of the menubutton. If you want to additionally left-justify multi-lined text you need also justify='left' . I hope this helps Michael From Krb686 at gmail.com Tue Jun 1 22:43:08 2010 From: Krb686 at gmail.com (Krb686) Date: Tue, 1 Jun 2010 13:43:08 -0700 (PDT) Subject: [Tkinter-discuss] Tkinter - Drawing Webcam Images? Message-ID: <28747239.post@talk.nabble.com> I'm pretty new to Python and Tkinter, so there might be an easier or more advanced way of doing this that I don't know of, but bear with me. I'm making a simple webcam gui using VideoCapture and PIL, and I realized that to get the video working you must retrieve and display the images in a loop on the gui, but you can't do this normally without threading because then the gui won't update any more, or at least as far as I know. So I need some help on this if anyone knows an easier way to do this without threading. And is it possible to allow your own code to run within the tkinter mainloop? Because then I could just allow it to update with the gui mainloop and not use threading. -- View this message in context: http://old.nabble.com/Tkinter---Drawing-Webcam-Images--tp28747239p28747239.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From Vasilis.Vlachoudis at cern.ch Wed Jun 2 09:16:01 2010 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 2 Jun 2010 09:16:01 +0200 Subject: [Tkinter-discuss] Drop events from Desktop Message-ID: <2AACD4EB2F123248A064A23843B3A17301DF2A3C@cernxchg47.cern.ch> Hi all, Is there a way in Tkinter to receive drag'n'drop events from the Desktop? e.g. from the filemanager drag a file in a Tkinter application Regards Vasilis -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Wed Jun 2 11:23:28 2010 From: klappnase at web.de (Michael Lange) Date: Wed, 2 Jun 2010 11:23:28 +0200 Subject: [Tkinter-discuss] Tkinter - Drawing Webcam Images? In-Reply-To: <28747239.post@talk.nabble.com> References: <28747239.post@talk.nabble.com> Message-ID: <20100602112328.0a5da062.klappnase@web.de> Hi, On Tue, 1 Jun 2010 13:43:08 -0700 (PDT) Krb686 wrote: > > I'm pretty new to Python and Tkinter, so there might be an easier or > more advanced way of doing this that I don't know of, but bear with > me. I'm making a simple webcam gui using VideoCapture and PIL, and I > realized that to get the video working you must retrieve and display > the images in a loop on the gui, but you can't do this normally > without threading because then the gui won't update any more, or at > least as far as I know. So I need some help on this if anyone knows > an easier way to do this without threading. And is it possible to > allow your own code to run within the tkinter mainloop? Because then > I could just allow it to update with the gui mainloop and not use > threading. Maybe you could use a loop with after() calls and update_idletasks() to update the image, like this simple example: def update_loop(): update_image() somewidget.update_idletasks() somewidget.after(100, update_loop) With a useful update_image() method you just need to enter the loop once and it should do what you want. I hope this helps Michael From klappnase at web.de Wed Jun 2 11:28:29 2010 From: klappnase at web.de (Michael Lange) Date: Wed, 2 Jun 2010 11:28:29 +0200 Subject: [Tkinter-discuss] Drop events from Desktop In-Reply-To: <2AACD4EB2F123248A064A23843B3A17301DF2A3C@cernxchg47.cern.ch> References: <2AACD4EB2F123248A064A23843B3A17301DF2A3C@cernxchg47.cern.ch> Message-ID: <20100602112829.f732054a.klappnase@web.de> Hi, On Wed, 2 Jun 2010 09:16:01 +0200 Vasilis Vlachoudis wrote: > Hi all, > > > > Is there a way in Tkinter to receive drag'n'drop events from the > Desktop? > > e.g. from the filemanager drag a file in a Tkinter application > > You can try the tkdnd Tk extension from http://sourceforge.net/projects/tkdnd/files/ and the respective Tkinter wrappers from http://klappnase.bubble.org/ However, your mileage may vary, depending on the platform (Windows / Mac /Linux) in use. I hope this helps Michael From mdata.cn at gmail.com Thu Jun 3 10:34:49 2010 From: mdata.cn at gmail.com (Ma China) Date: Thu, 3 Jun 2010 16:34:49 +0800 Subject: [Tkinter-discuss] problems of Tix.FileEntry and tkMessageBox in WinXP Message-ID: Hi, friends I'm programming with Tkinter/Tix. I want to use Tix.FileEntry, and only find fe_obj['value'] to get the selected file, is there any other way? As I find it may cause some memory problems, while used with tkMessageBox. Running the following codes, if I click "Work" twice, the program will crash before the 2nd warning sub-window pops up. Even if I comment the 2 lines of adding Label self.sflb, it still dump. My pc is WinXP Version 2002 Service Pack 3, CPU is Intel Core2 2-core, with Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32. I find it may be due to conflicts with Tix.FileEntry. How to fix it? import Tkinter, Tix import tkMessageBox, tkFileDialog class Worker(): def __init__(self): self.root = Tix.Tk() self.sffm = Tkinter.Frame(self.root) self.sflb = Tkinter.Label(self.sffm, text='Select file :') self.sflb.pack(side='left') self.sfft = Tix.FileEntry (self.sffm) self.sfft.pack(side='left') self.btfm = Tkinter.Frame(self.root) self.gnbt = Tkinter.Button(self.btfm,text='Work', command=self.work) self.gnbt.pack(side='left') self.sffm.pack() self.btfm.pack() Tkinter.mainloop() def work(self) : ''' do all work ''' print 1 value = self.sfft["value"] # use showwarning/showerror, if click "Work' for 2 times, will dump tkMessageBox.showwarning('Title', '<%s>' % value) print '+%s+' % value if __name__=='__main__': worker = Worker() -------------- next part -------------- An HTML attachment was scrubbed... URL: From bradley.h at aggiemail.usu.edu Wed Jun 9 16:36:30 2010 From: bradley.h at aggiemail.usu.edu (Bradley Hintze) Date: Wed, 9 Jun 2010 10:36:30 -0400 Subject: [Tkinter-discuss] Labels with no background Message-ID: Hi, I'm trying to get a label in a canvas without a background. is this possible. Currently it defaults to white. -- Bradley J. Hintze Graduate Student Duke University School of Medicine 801-712-8799 From halbert at halwitz.org Wed Jun 9 16:58:15 2010 From: halbert at halwitz.org (Dan Halbert) Date: Wed, 9 Jun 2010 10:58:15 -0400 (EDT) Subject: [Tkinter-discuss] Labels with no background In-Reply-To: References: Message-ID: <1276095495.476631229@192.168.2.230> On Wednesday, June 9, 2010 10:36am, "Bradley Hintze" said: > Hi, I'm trying to get a label in a canvas without a background. is > this possible. Currently it defaults to white. Do you really need a label, or could you just use a Canvas text object (create_text())? Those do not have a background. My impression is that widgets with transparent backgrounds is a hard problem, and are not generally available in Tk. Dan From strider1066 at gmail.com Sun Jun 13 17:50:12 2010 From: strider1066 at gmail.com (Steve Solomon) Date: Sun, 13 Jun 2010 08:50:12 -0700 Subject: [Tkinter-discuss] Persistent text-widget tags: saving tags in text-files. Message-ID: Hello, Is it possible to save and reload a text document with its' tags still embedded in a document produced in the Text widget, and if so how? It seems that it should be possible in order not to discard hours of work formatting a text file. Thank you Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Mon Jun 14 16:27:31 2010 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 14 Jun 2010 10:27:31 -0400 Subject: [Tkinter-discuss] Persistent text-widget tags: saving tags in text-files. In-Reply-To: References: Message-ID: <4C163C53.9090504@codebykevin.com> On 6/13/10 11:50 AM, Steve Solomon wrote: > Hello, > Is it possible to save and reload a text document with its' tags still > embedded in a document produced in the Text widget, and if so how? It > seems that it should be possible in order not to discard hours of work > formatting a text file. > > Thank you > Steve The text widget has a "dump" command that should do what you want: it returns all data in the text widget, including tags. See the Tk text man page. For a more complete example, http://wiki.tcl.tk/9167 might be helpful. You'll have to translate the Tcl to Python. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From bradley.h at aggiemail.usu.edu Mon Jun 14 21:01:41 2010 From: bradley.h at aggiemail.usu.edu (Bradley Hintze) Date: Mon, 14 Jun 2010 15:01:41 -0400 Subject: [Tkinter-discuss] Labels with no background In-Reply-To: <1276095495.476631229@192.168.2.230> References: <1276095495.476631229@192.168.2.230> Message-ID: create_text() moves with the 'scroll' of the canvas where as label does not which is a functionality that I need. Bradley On Wed, Jun 9, 2010 at 10:58 AM, Dan Halbert wrote: > On Wednesday, June 9, 2010 10:36am, "Bradley Hintze" said: >> Hi, I'm trying to get a label in a canvas without a background. is >> this possible. Currently it defaults to white. > > Do you really need a label, or could you just use a Canvas text object (create_text())? Those do not have a background. My impression is that widgets with transparent backgrounds is a hard problem, and are not generally available in Tk. > > Dan > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- Bradley J. Hintze Graduate Student Duke University School of Medicine 801-712-8799 From timj at tolisgroup.com Mon Jun 14 21:27:18 2010 From: timj at tolisgroup.com (Tim Jones) Date: Mon, 14 Jun 2010 12:27:18 -0700 Subject: [Tkinter-discuss] Labels with no background In-Reply-To: References: <1276095495.476631229@192.168.2.230> Message-ID: <5A823F34-54E4-4CA2-8CEA-F0006AD91879@tolisgroup.com> On Jun 14, 2010, at 12:01 PM, Bradley Hintze wrote: > create_text() moves with the 'scroll' of the canvas where as label > does not which is a functionality that I need. Bradley, What if you place your text into a small, empty canvas and then place that small canvas on top of your main canvas (basically creating your own label)? Tim From bradley.h at aggiemail.usu.edu Mon Jun 14 22:19:04 2010 From: bradley.h at aggiemail.usu.edu (Bradley Hintze) Date: Mon, 14 Jun 2010 16:19:04 -0400 Subject: [Tkinter-discuss] Labels with no background In-Reply-To: <5A823F34-54E4-4CA2-8CEA-F0006AD91879@tolisgroup.com> References: <1276095495.476631229@192.168.2.230> <5A823F34-54E4-4CA2-8CEA-F0006AD91879@tolisgroup.com> Message-ID: Great Idea. Thanks! On Mon, Jun 14, 2010 at 3:27 PM, Tim Jones wrote: > On Jun 14, 2010, at 12:01 PM, Bradley Hintze wrote: > >> create_text() moves with the 'scroll' of the canvas where as label >> does not which is a functionality that I need. > > Bradley, > > What if you place your text into a small, empty canvas and then place that small canvas on top of your main canvas (basically creating your own label)? > > Tim > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- Bradley J. Hintze Graduate Student Duke University School of Medicine 801-712-8799 From strider1066 at gmail.com Wed Jun 16 00:13:54 2010 From: strider1066 at gmail.com (Steve Solomon) Date: Tue, 15 Jun 2010 15:13:54 -0700 Subject: [Tkinter-discuss] Persistent text-widget tags: saving tags in text-files. Message-ID: Kevin, Thank you, that will get me started in the right direction. Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From ziz.root at gmail.com Sun Jun 20 04:06:45 2010 From: ziz.root at gmail.com (zizou afix) Date: Sun, 20 Jun 2010 04:06:45 +0200 Subject: [Tkinter-discuss] adjust the size of two canvas when I resize Message-ID: Hi, i'm a new user of tkinter, I would like to adjust my canevas to the main window when a resize it. i've just find this on the web : http://infohost.nmt.edu/tcc/help/pubs/tkinter/layout-mgt.html#root-resize but in my case that don't work this is my code : 2 canvas and 2 scrollbars it runs but it does not fit at the window if someone can help me, very very thanks ##################################################################################### from Tkinter import * class Application(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.grid(sticky=N+S+E+W) self.canCompose() def canCompose(self): top=self.winfo_toplevel() top.rowconfigure(0, weight=1) top.columnconfigure(1, weight=1) self.rowconfigure(0, weight=1) self.columnconfigure(1, weight=1) self.canCompose = Canvas(self, width = 800, height = 400 ,bg = 'red', scrollregion=(0,0,100,400)) self.canComposeTitle = Canvas(self, width = 100, height =400 ,bg = 'blue', scrollregion=(0,0,0,400)) self.canComposeTitle.grid(row=0, column=0, sticky=N+S+E+W) self.canCompose.grid(row=0, column=1, sticky=N+S+E+W) self.scrollCompose_y = Scrollbar(self, orient='vertical') self.scrollCompose_y.config(command = self.twoScroll) self.scrollCompose_x = Scrollbar(self, orient='horizontal', command=self.canCompose.xview) self.canComposeTitle['yscrollcommand'] = self.scrollCompose_y.set self.canCompose['yscrollcommand'] = self.scrollCompose_y.set self.canCompose['xscrollcommand'] = self.scrollCompose_x.set self.scrollCompose_y.grid(row=0, column=2,sticky=N+S) self.scrollCompose_x.grid(row=1, column=0, columnspan=2, sticky=E+W) def twoScroll(self, *args): """Send y scroll *args to the two canvas""" self.canCompose.yview(*args) self.canComposeTitle.yview(*args) print args app = Application() app.master.title("Sample application") app.mainloop() ##################################################################################### -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Sun Jun 20 11:25:36 2010 From: klappnase at web.de (Michael Lange) Date: Sun, 20 Jun 2010 11:25:36 +0200 Subject: [Tkinter-discuss] adjust the size of two canvas when I resize In-Reply-To: References: Message-ID: <20100620112536.573c74bb.klappnase@web.de> Hi Zizou, On Sun, 20 Jun 2010 04:06:45 +0200 zizou afix wrote: > Hi, > i'm a new user of tkinter, > I would like to adjust my canevas to the main window when a resize it. > i've just find this on the web : > http://infohost.nmt.edu/tcc/help/pubs/tkinter/layout-mgt.html#root-resize > but in my case that don't work > > this is my code : > 2 canvas and 2 scrollbars > it runs but it does not fit at the window > if someone can help me, very very thanks > > ##################################################################################### > from Tkinter import * > > class Application(Frame): > def __init__(self, master=None): First we should find out which widget(s) actually does not expand when the window is resized. To do so it may be helpful to change the background color of the Frame surrounding the two Canvases : > Frame.__init__(self, master, bg='yellow') > self.grid(sticky=N+S+E+W) > self.canCompose() When you run this slightly modified example you will see that it is actually the Frame that does not get resized, not the Canvases. When I change the line self.grid(sticky=N+S+E+W) into self.pack(fill='both', expand=1) the Frame will expand as expected when the window is resized. So we see that the self.grid(...) command is the problematic part. In fact in your example the Frame expands vertically, but not horizontally, but why? The explanation is a few lines below: > > def canCompose(self): > top=self.winfo_toplevel() > top.rowconfigure(0, weight=1) > top.columnconfigure(1, weight=1) Here you tell the application window to expand row 0 and column 1 when the window is resized, but a few lines above you put your Frame into row 0 and column 0 (yet not explicitely, but if you do not define grid cells, the grid manager will begin automagically with row 0 and col. 0). So the solution is to change either self.grid(sticky=N+S+E+W) into self.grid(row=0, column=1, sticky=N +S +E +W) or top.columnconfigure(1, weight=1) into top.columnconfigure(0, weight=1) I hope this helps Michael From ziz.root at gmail.com Sun Jun 20 15:19:40 2010 From: ziz.root at gmail.com (zizou afix) Date: Sun, 20 Jun 2010 15:19:40 +0200 Subject: [Tkinter-discuss] Tkinter-discuss Digest, Vol 76, Issue 9 In-Reply-To: References: Message-ID: Hi Michael, I understand your clear explanations and now it works. thanks a lot ziz 2010/6/20 > Send Tkinter-discuss mailing list submissions to > tkinter-discuss at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tkinter-discuss > or, via email, send a message with subject or body 'help' to > tkinter-discuss-request at python.org > > You can reach the person managing the list at > tkinter-discuss-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tkinter-discuss digest..." > > > Today's Topics: > > 1. adjust the size of two canvas when I resize (zizou afix) > 2. Re: adjust the size of two canvas when I resize (Michael Lange) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 20 Jun 2010 04:06:45 +0200 > From: zizou afix > To: tkinter-discuss at python.org > Subject: [Tkinter-discuss] adjust the size of two canvas when I resize > Message-ID: > > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > i'm a new user of tkinter, > I would like to adjust my canevas to the main window when a resize it. > i've just find this on the web : > http://infohost.nmt.edu/tcc/help/pubs/tkinter/layout-mgt.html#root-resize > but in my case that don't work > > this is my code : > 2 canvas and 2 scrollbars > it runs but it does not fit at the window > if someone can help me, very very thanks > > > ##################################################################################### > from Tkinter import * > > class Application(Frame): > def __init__(self, master=None): > Frame.__init__(self, master) > self.grid(sticky=N+S+E+W) > self.canCompose() > > def canCompose(self): > top=self.winfo_toplevel() > top.rowconfigure(0, weight=1) > top.columnconfigure(1, weight=1) > self.rowconfigure(0, weight=1) > self.columnconfigure(1, weight=1) > > self.canCompose = Canvas(self, width = 800, height = 400 ,bg = > 'red', scrollregion=(0,0,100,400)) > self.canComposeTitle = Canvas(self, width = 100, height =400 ,bg = > 'blue', scrollregion=(0,0,0,400)) > > self.canComposeTitle.grid(row=0, column=0, > sticky=N+S+E+W) > self.canCompose.grid(row=0, column=1, > sticky=N+S+E+W) > > self.scrollCompose_y = Scrollbar(self, orient='vertical') > self.scrollCompose_y.config(command = self.twoScroll) > self.scrollCompose_x = Scrollbar(self, orient='horizontal', > command=self.canCompose.xview) > > self.canComposeTitle['yscrollcommand'] = self.scrollCompose_y.set > self.canCompose['yscrollcommand'] = self.scrollCompose_y.set > self.canCompose['xscrollcommand'] = self.scrollCompose_x.set > self.scrollCompose_y.grid(row=0, column=2,sticky=N+S) > self.scrollCompose_x.grid(row=1, column=0, columnspan=2, sticky=E+W) > > def twoScroll(self, *args): > """Send y scroll *args to the two canvas""" > self.canCompose.yview(*args) > self.canComposeTitle.yview(*args) > print args > > app = Application() > app.master.title("Sample application") > app.mainloop() > > ##################################################################################### > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tkinter-discuss/attachments/20100620/a0884c94/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Sun, 20 Jun 2010 11:25:36 +0200 > From: Michael Lange > To: tkinter-discuss at python.org > Subject: Re: [Tkinter-discuss] adjust the size of two canvas when I > resize > Message-ID: <20100620112536.573c74bb.klappnase at web.de> > Content-Type: text/plain; charset=US-ASCII > > Hi Zizou, > > On Sun, 20 Jun 2010 04:06:45 +0200 > zizou afix wrote: > > > Hi, > > i'm a new user of tkinter, > > I would like to adjust my canevas to the main window when a resize it. > > i've just find this on the web : > > > http://infohost.nmt.edu/tcc/help/pubs/tkinter/layout-mgt.html#root-resize > > but in my case that don't work > > > > this is my code : > > 2 canvas and 2 scrollbars > > it runs but it does not fit at the window > > if someone can help me, very very thanks > > > > > ##################################################################################### > > from Tkinter import * > > > > class Application(Frame): > > def __init__(self, master=None): > > First we should find out which widget(s) actually does not expand when > the window is resized. To do so it may be helpful to change the > background color of the Frame surrounding the two Canvases : > > > Frame.__init__(self, master, bg='yellow') > > self.grid(sticky=N+S+E+W) > > self.canCompose() > > When you run this slightly modified example you will see that it is > actually the Frame that does not get resized, not the Canvases. > When I change the line > > self.grid(sticky=N+S+E+W) > > into > > self.pack(fill='both', expand=1) > > the Frame will expand as expected when the window is resized. So we see > that the self.grid(...) command is the problematic part. In fact in > your example the Frame expands vertically, but not horizontally, but > why? The explanation is a few lines below: > > > > > def canCompose(self): > > top=self.winfo_toplevel() > > top.rowconfigure(0, weight=1) > > top.columnconfigure(1, weight=1) > > Here you tell the application window to expand row 0 and column 1 when > the window is resized, but a few lines above you put your Frame into > row 0 and column 0 (yet not explicitely, but if you do not define grid > cells, the grid manager will begin automagically with row 0 and col. 0). > So the solution is to change either > > self.grid(sticky=N+S+E+W) into > self.grid(row=0, column=1, sticky=N +S +E +W) > or > top.columnconfigure(1, weight=1) into > top.columnconfigure(0, weight=1) > > I hope this helps > > Michael > > > > > ------------------------------ > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > End of Tkinter-discuss Digest, Vol 76, Issue 9 > ********************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wet_colored_arch at yahoo.com Tue Jun 22 22:44:00 2010 From: wet_colored_arch at yahoo.com (wet_colored)arch) Date: Tue, 22 Jun 2010 13:44:00 -0700 (PDT) Subject: [Tkinter-discuss] touch screens Message-ID: <28964837.post@talk.nabble.com> Can anyone point me to information on how to use or extend tkinter for use with touch screens? I have an application written in Tkinter that works fine, and I am newbie enough to GUIs that I don't know Qt or other. Is there an extension or something native in Tkinter I can use? What do you recommend I do if there is nothing in Tkinter. -- View this message in context: http://old.nabble.com/touch-screens-tp28964837p28964837.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From bob at passcal.nmt.edu Tue Jun 22 23:55:09 2010 From: bob at passcal.nmt.edu (Bob Greschke) Date: Tue, 22 Jun 2010 15:55:09 -0600 Subject: [Tkinter-discuss] touch screens In-Reply-To: <28964837.post@talk.nabble.com> References: <28964837.post@talk.nabble.com> Message-ID: <97B9A574-DCB6-4E97-8CA0-A9A18F22F38B@passcal.nmt.edu> We played with a touch screen display for a little while (entuative touchscreen elo monitor - no one can spell anything that makes sense anymore) and the driver for it (Windows anyway) handled all of the dirty work. If there was a simple tkinter button on the display, and you "touched" it tkinter just reacted as if you'd used the mouse to click on it. You didn't have to worry about the X,Y of where the user touched or anything like that. We didn't end up using it for anything. It was more trouble than it was worth for the operators. They needed to not just click on buttons, but type in stuff and drag over a Listbox of stuff, etc. on a routine basis. It would have been fine for something like a kiosk for mostly clicking on buttons. Bob On Jun 22, 2010, at 14:44, wet_colored)arch wrote: > > Can anyone point me to information on how to use or extend tkinter for use > with touch screens? I have an application written in Tkinter that works > fine, and I am newbie enough to GUIs that I don't know Qt or other. Is > there an extension or something native in Tkinter I can use? What do you > recommend I do if there is nothing in Tkinter. > -- > View this message in context: http://old.nabble.com/touch-screens-tp28964837p28964837.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 michael.odonnell at uam.es Wed Jun 23 09:19:28 2010 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Wed, 23 Jun 2010 09:19:28 +0200 Subject: [Tkinter-discuss] touch screens In-Reply-To: <28964837.post@talk.nabble.com> References: <28964837.post@talk.nabble.com> Message-ID: Hi, I was looking at porting my python-tk application to the iPad. Applications need to be in Objective C. While Objective C can handle python via pyObjC, this cannot handle tkinter, and basically one would need to rewrite your GUI components in the machine's graphic language. Mick On Tue, Jun 22, 2010 at 10:44 PM, wet_colored)arch wrote: > > Can anyone point me to information on how to use or extend tkinter for use > with touch screens? ?I have an application written in Tkinter that works > fine, and I am newbie enough to GUIs that I don't know Qt or other. ?Is > there an extension or something native in Tkinter I can use? ?What do you > recommend I do if there is nothing in Tkinter. > -- > View this message in context: http://old.nabble.com/touch-screens-tp28964837p28964837.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 kw at codebykevin.com Wed Jun 23 16:03:32 2010 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 23 Jun 2010 10:03:32 -0400 Subject: [Tkinter-discuss] touch screens In-Reply-To: References: <28964837.post@talk.nabble.com> Message-ID: <4C221434.7010706@codebykevin.com> On 6/23/10 3:19 AM, Michael O'Donnell wrote: > Hi, > > I was looking at porting my python-tk application to the iPad. > Applications need to be in Objective C. While Objective C can handle > python via pyObjC, this cannot handle tkinter, and basically one > would need to rewrite your GUI components in the machine's graphic language. > > Mick PyObjC isn't supported on the iPad or iPhone: C-level languages only. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From michael.odonnell at uam.es Wed Jun 23 16:51:10 2010 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Wed, 23 Jun 2010 16:51:10 +0200 Subject: [Tkinter-discuss] touch screens In-Reply-To: <4C221434.7010706@codebykevin.com> References: <28964837.post@talk.nabble.com> <4C221434.7010706@codebykevin.com> Message-ID: Hi Kevin, I have not tried porting python to iphones myself, but there are a number of websites saying they have done it (assuming a jailbroken iphone), e.g., http://www.saurik.com/id/5 http://gizmodo.com/282139/iphone-can-now-serve-web-pages-run-python-open-source-apps http://www.youtube.com/watch?v=iFrzSDdTXkk http://bytes.com/topic/python/answers/851129-python-iphone-actually-rather-good ...and if doable on an iphone, I assume iPad as well. Mick On Wed, Jun 23, 2010 at 4:03 PM, Kevin Walzer wrote: > On 6/23/10 3:19 AM, Michael O'Donnell wrote: >> >> Hi, >> >> ? ?I was looking at porting my python-tk application to the iPad. >> Applications need to be in Objective C. While Objective C can handle >> python via pyObjC, this cannot handle tkinter, and basically one >> would need to rewrite your GUI components in the machine's graphic >> language. >> >> Mick > > PyObjC isn't supported on the iPad or iPhone: C-level languages only. > > -- > 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 > From kw at codebykevin.com Wed Jun 23 17:12:49 2010 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 23 Jun 2010 11:12:49 -0400 Subject: [Tkinter-discuss] touch screens In-Reply-To: References: <28964837.post@talk.nabble.com> <4C221434.7010706@codebykevin.com> Message-ID: <4C222471.1040008@codebykevin.com> On 6/23/10 10:51 AM, Michael O'Donnell wrote: > Hi Kevin, > > I have not tried porting python to iphones myself, > but there are a number of websites saying they have done > it (assuming a jailbroken iphone), e.g., > > http://www.saurik.com/id/5 > http://gizmodo.com/282139/iphone-can-now-serve-web-pages-run-python-open-source-apps > http://www.youtube.com/watch?v=iFrzSDdTXkk > http://bytes.com/topic/python/answers/851129-python-iphone-actually-rather-good > > ...and if doable on an iphone, I assume iPad as well. > > Mick Fair enough, but I wasn't considering jailbroken hardware. :-) -- Kevin Walzer Code by Kevin http://www.codebykevin.com From Vasilis.Vlachoudis at cern.ch Fri Jun 25 12:20:30 2010 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Fri, 25 Jun 2010 12:20:30 +0200 Subject: [Tkinter-discuss] How to capture exceptions after the end of the program Message-ID: <4C2482EE.9080703@cern.ch> Hi all, I have a tkinter application that uses several fonts. However only with python 2.4 when the application is closed then I get the following exceptions (with 2.6 it works Ok) Exception exceptions.AttributeError: "'NoneType' object has no attribute 'TclError'" in > ignored Exception exceptions.AttributeError: "'NoneType' object has no attribute 'TclError'" in > ignored and I have no way of capturing them since they arrive even after the last line of the program. I believe that for some reason the tkinter is deleted before and afterwards it tries to delete the fonts and creates the TclError. Is there a way to protect for these exceptions? I was getting the same problem with the PhotoImage() but now I am trying to delete all of them before the end of the program to avoid the exceptions. However with fonts I can miss something e.g replace a font and exit afterwards. Thanks in advance Vasilis -- ------------------------------------------------------- Vasilis Vlachoudis Dep. EN-STI-EET Web: home.cern.ch/bnv Tel: +41-22-7679851 Fax: +41-22-7669644 ------------------------------------------------------- From waynejwerner at gmail.com Fri Jun 25 13:14:37 2010 From: waynejwerner at gmail.com (Wayne Werner) Date: Fri, 25 Jun 2010 06:14:37 -0500 Subject: [Tkinter-discuss] How to capture exceptions after the end of the program In-Reply-To: <4C2482EE.9080703@cern.ch> References: <4C2482EE.9080703@cern.ch> Message-ID: On Fri, Jun 25, 2010 at 5:20 AM, Vasilis Vlachoudis < Vasilis.Vlachoudis at cern.ch> wrote: > Hi all, > > I have a tkinter application that uses several fonts. However only with > python 2.4 when the application is closed then I get the following > exceptions (with 2.6 it works Ok) > > Exception exceptions.AttributeError: "'NoneType' object has no attribute > 'TclError'" in 0x2ac0dd4c4908>> ignored > Exception exceptions.AttributeError: "'NoneType' object has no attribute > 'TclError'" in 0x2ac0dd4c4680>> ignored > > and I have no way of capturing them since they arrive even after the last > line of the program. > I believe that for some reason the tkinter is deleted before and afterwards > it tries to delete the fonts and creates the TclError. > Is there a way to protect for these exceptions? > If you're on linux you can redirect the errors via $ python myfile.py > mylog.txt I'm not sure how you would catch the exceptions, though. -Wayne -------------- next part -------------- An HTML attachment was scrubbed... URL: From Vasilis.Vlachoudis at cern.ch Fri Jun 25 13:54:57 2010 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Fri, 25 Jun 2010 13:54:57 +0200 Subject: [Tkinter-discuss] How to capture exceptions after the end of the program In-Reply-To: References: <4C2482EE.9080703@cern.ch> Message-ID: <4C249911.3080208@cern.ch> Thanks Wayne, unfortunately I cannot do that since I am using the output for other messages Vasilis On 06/25/10 13:14, Wayne Werner wrote: > On Fri, Jun 25, 2010 at 5:20 AM, Vasilis Vlachoudis > > wrote: > > Hi all, > > I have a tkinter application that uses several fonts. However only > with python 2.4 when the application is closed then I get the > following exceptions (with 2.6 it works Ok) > > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'TclError'" in > ignored > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'TclError'" in > ignored > > and I have no way of capturing them since they arrive even after > the last line of the program. > I believe that for some reason the tkinter is deleted before and > afterwards it tries to delete the fonts and creates the TclError. > Is there a way to protect for these exceptions? > > > If you're on linux you can redirect the errors via > > $ python myfile.py > mylog.txt > > I'm not sure how you would catch the exceptions, though. > > -Wayne -- ------------------------------------------------------- Vasilis Vlachoudis Dep. EN-STI-EET Web: home.cern.ch/bnv Tel: +41-22-7679851 Fax: +41-22-7669644 ------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cameron at phaseit.net Fri Jun 25 19:15:02 2010 From: Cameron at phaseit.net (Cameron Laird) Date: Fri, 25 Jun 2010 17:15:02 +0000 Subject: [Tkinter-discuss] How to capture exceptions after the end of the program In-Reply-To: <4C249911.3080208@cern.ch> References: <4C2482EE.9080703@cern.ch> <4C249911.3080208@cern.ch> Message-ID: <20100625171501.GA15684@lairds.us> On Fri, Jun 25, 2010 at 01:54:57PM +0200, Vasilis Vlachoudis wrote: . . . > unfortunately I cannot do that since I am using the output for other > messages > > Vasilis > > On 06/25/10 13:14, Wayne Werner wrote: > >On Fri, Jun 25, 2010 at 5:20 AM, Vasilis Vlachoudis > >> wrote: > > > > Hi all, > > > > I have a tkinter application that uses several fonts. However only > > with python 2.4 when the application is closed then I get the > > following exceptions (with 2.6 it works Ok) > > > > Exception exceptions.AttributeError: "'NoneType' object has no > > attribute 'TclError'" in > > ignored > > Exception exceptions.AttributeError: "'NoneType' object has no > > attribute 'TclError'" in > > ignored > > > > and I have no way of capturing them since they arrive even after > > the last line of the program. > > I believe that for some reason the tkinter is deleted before and > > afterwards it tries to delete the fonts and creates the TclError. > > Is there a way to protect for these exceptions? > > > > > >If you're on linux you can redirect the errors via > > > >$ python myfile.py > mylog.txt > > > >I'm not sure how you would catch the exceptions, though. . . . While I've become quite confused about what "that" is, Vasilis, please be aware that the same data can go to more than one sink. , for example, might interest you--if you're not already aware of it. From klappnase at web.de Fri Jun 25 22:39:14 2010 From: klappnase at web.de (Michael Lange) Date: Fri, 25 Jun 2010 22:39:14 +0200 Subject: [Tkinter-discuss] How to capture exceptions after the end of the program In-Reply-To: <4C2482EE.9080703@cern.ch> References: <4C2482EE.9080703@cern.ch> Message-ID: <20100625223914.150cfe1c.klappnase@web.de> Hi Vasilis, On Fri, 25 Jun 2010 12:20:30 +0200 Vasilis Vlachoudis wrote: > Hi all, > > I have a tkinter application that uses several fonts. However only > with python 2.4 when the application is closed then I get the > following exceptions (with 2.6 it works Ok) > > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'TclError'" in instance at > 0x2ac0dd4c4908>> ignored > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'TclError'" in instance at > 0x2ac0dd4c4680>> ignored > > and I have no way of capturing them since they arrive even after the > last line of the program. > I believe that for some reason the tkinter is deleted before and > afterwards it tries to delete the fonts and creates the TclError. > Is there a way to protect for these exceptions? > > I was getting the same problem with the PhotoImage() but now I am > trying to delete all of them before the end of the program to avoid > the exceptions. However with fonts I can miss something e.g replace a > font and exit afterwards. > Can you provide a minimal code example that exhibits the problem? Michael From ziz.root at gmail.com Sat Jun 26 08:26:12 2010 From: ziz.root at gmail.com (zizou afix) Date: Sat, 26 Jun 2010 08:26:12 +0200 Subject: [Tkinter-discuss] problem of understanding objects Message-ID: hi, i try to organize my code. but i ' ve some problem with basic objet oriented programing use. if some one can show me the way to destroy my canvas with this structure. thanks laurent ########################################################################## from Tkinter import * class Root: def __init__(self, master): myMenu = MyMenu(master) myAccueil = MyAccueil(master) class MyAccueil(object): def __init__(self, master): canvas = Canvas(master, width = 500, height = 500, bg='yellow' ) canvas.pack(expand = YES, fill = BOTH) def delete(self): # my object problem canvas.destroy() # is here class MyMenu(object): def __init__(self, master): self.menubar = Menu(master) master.config(menu=self.menubar) self.createmenubar(master) def createmenubar(self, master): self.Fmenu = Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="exec",menu=self.Fmenu) # exec Content self.Fmenu.add_command(label="bang", command=self.bang) # Displays menubar master.config(menu=self.menubar) def bang(self): # and myAccueil.delete() # here root = Tk() app = Root(root) root.mainloop() ########################################################################## -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cameron at phaseit.net Sun Jun 27 21:06:43 2010 From: Cameron at phaseit.net (Cameron Laird) Date: Sun, 27 Jun 2010 19:06:43 +0000 Subject: [Tkinter-discuss] problem of understanding objects In-Reply-To: References: Message-ID: <20100627190643.GA30551@lairds.us> On Sat, Jun 26, 2010 at 08:26:12AM +0200, zizou afix wrote: . . . > i try to organize my code. but i ' ve some problem with basic objet oriented > programing use. > if some one can show me the way to destroy my canvas with this structure. > thanks > > laurent > > ########################################################################## > from Tkinter import * > > class Root: > > def __init__(self, master): > myMenu = MyMenu(master) > myAccueil = MyAccueil(master) > > class MyAccueil(object): > def __init__(self, master): > > canvas = Canvas(master, width = 500, height = 500, bg='yellow' ) > canvas.pack(expand = YES, fill = BOTH) > > def delete(self): # my object problem > canvas.destroy() # is here > > > class MyMenu(object): > > def __init__(self, master): > self.menubar = Menu(master) > master.config(menu=self.menubar) > self.createmenubar(master) > > def createmenubar(self, master): > self.Fmenu = Menu(self.menubar, tearoff=0) > self.menubar.add_cascade(label="exec",menu=self.Fmenu) > # exec Content > self.Fmenu.add_command(label="bang", command=self.bang) > # Displays menubar > master.config(menu=self.menubar) > > def bang(self): # and > myAccueil.delete() # here > > root = Tk() > app = Root(root) > > root.mainloop() > ########################################################################## . . . I'm uncertain what you're trying to achieve; does the following help you approach your goal? ############################################################### from Tkinter import * class Root: def __init__(self, master): myMenu = MyMenu(master) self.myAccueil = MyAccueil(master) class MyAccueil(object): def __init__(self, master): self.canvas = Canvas(master, width = 500, height = 500, bg='yellow' ) self.canvas.pack(expand = YES, fill = BOTH) def delete(self): # my object problem self.canvas.destroy() # is here class MyMenu(object): def __init__(self, master): self.menubar = Menu(master) master.config(menu=self.menubar) self.createmenubar(master) def createmenubar(self, master): self.Fmenu = Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="exec",menu=self.Fmenu) # exec Content self.Fmenu.add_command(label="bang", command=self.bang) # Displays menubar master.config(menu=self.menubar) def bang(self): # and app.myAccueil.delete() # here root = Tk() app = Root(root) root.mainloop()