From ggpolo at gmail.com Sun Mar 1 00:28:51 2009 From: ggpolo at gmail.com (Guilherme Polo) Date: Sat, 28 Feb 2009 20:28:51 -0300 Subject: [Tkinter-discuss] pack: difference between anchor and side options? (also anchor as a widget option) In-Reply-To: <93565a2c0902281452y54e3911cp7795a8e024fb7633@mail.gmail.com> References: <93565a2c0902131417o42bc1bacqdb7ea124b66ffaaa@mail.gmail.com> <93565a2c0902281452y54e3911cp7795a8e024fb7633@mail.gmail.com> Message-ID: On Sat, Feb 28, 2009 at 7:52 PM, John Anon wrote: > Guilherme, > > Sorry for the very late reply, and thank you very much for the information. > > So, `side` seems to have precedence over `anchor`. Very good. I'll > experiment with it soon and try to make some time to add my findings > and sample code to [the wiki](http://tkinter.unpythonic.net/wiki/). > I wouldn't say the side option has higher precedence than the anchor option. They work together, when you specify only one of them the other assumes its default value, when you specify neither of them then they both assume their default values. Have fun testing the combinations ;) > In the meantime, I added a LayoutManagement wiki page (linked to from > the front page) Looks a good addition, I have no idea when I will be able to contribute to it (or even if it will be needed) but I can take a look at it at least. > along with a small amount of content. > > > > > On Tue, Feb 17, 2009 at 10:04 PM, Guilherme Polo wrote: >> On Fri, Feb 13, 2009 at 7:17 PM, John Anon wrote: >>> What is the difference between `foo.pack(anchor=...)` and `foo.pack(side=...)`? >>> >> >> With "side" you have only four option: top, right, bottom and left, >> with "anchor" you can use some combinations of n, w, s, e or use >> center (the default). You can also use anchor and side at same time, >> for example x.pack(side='top', anchor=''w'). side='top' is the default >> one, it defines where in the master the widget will be packed, anchor >> defines the position of the widget in this side you chose. >> >>> Actually, regarding `anchor`, I see that you can also use it as an >>> option when creating a widget (ex. `Button(parent, anchor=...)` ). >>> What's the difference between using it with pack and using as a widget >>> option? >> >> For using it with pack see the paragraph above. >> Now when you use the option "anchor" while creating a Button, it will >> be defining where its text and/or image will be placed in the widget, >> just like described above. Try creating a Button with some text, pack >> it with expand=True and fill='both' and change the value in anchor to >> see how it behaves. >> >> Anyway, by now (4 days late) you probably already found out all this :) >> >> Regards, >> >> -- >> -- Guilherme H. Polo Goncalves >> > -- -- Guilherme H. Polo Goncalves From jepler at unpythonic.net Mon Mar 2 18:12:56 2009 From: jepler at unpythonic.net (Jeff Epler) Date: Mon, 2 Mar 2009 11:12:56 -0600 Subject: [Tkinter-discuss] The wiki -- spammers and permission to edit Message-ID: <20090302171256.GB7841@unpythonic.net> The wiki has been seeing a ton of spam since I upgraded to a modern version of moin (isn't that ironic! perhaps I should downgrade again). Simply requiring users to sign in before editing has also not proven to be enough. I am stuck with Ubuntu Hardy Heron's version of moin, so I can't enable advanced features like TextCha that are in the newest versions of moin. (I am using BadContent and LocalBadContent, but those are useless against the current kind of spam which consist of creating a new page and then putting the actual spam in an attachment to the page!) Therefore, I've chosen to implement a whitelist of approved editors. Create a wiki account if you don't have one yet, and I'll add you to the page ApprovedEditorsGroup. (actually, anyone who is an approved editor can edit this page, and I've added all people who edited pages since 2005). I'm open to better suggestions, again with the caveat that I'm stuck on hardy heron's version of moin, 1.5.8-5.1ubuntu2.2. I'm also open to anyone who is able to take over the wiki and do a better job at technical countermeasures than me, or an initiative to move the information on it to the common Python wiki. I'm sorry for the inconvenience this will cause for everyone who would like to contribute to the wiki. Jeff From Allen.Taylor at mdacorporation.com Mon Mar 2 21:59:40 2009 From: Allen.Taylor at mdacorporation.com (Allen Taylor) Date: Mon, 02 Mar 2009 15:59:40 -0500 Subject: [Tkinter-discuss] Announcement: Tka11y initial release - Accessibility-aware Tkinter Message-ID: <49AC026B.FA48.005C.0@mdacorporation.com> The initial version of Tka11y is released. You can find it at http://pypi.python.org/pypi/Tka11y. >From the package description... This module makes it possible for accessibility (a11y) clients (e.g., audible readers, magnifiers, etc.) to get accessibility data (name, description, role, actions, etc.) from the Tk widgets of Python applications that use Tkinter. It also allows automated GUI application testers that use the accessibility interface (such as dogtail, LDTP, and Accerciser) to control the Tk widgets of these applications. Currently, accessibility is only available via ATK <=> AT-SPI on Linux. Sorry, no Windows MSAA support. Enjoy! Allen B. Taylor -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw at codebykevin.com Mon Mar 2 23:14:38 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 02 Mar 2009 17:14:38 -0500 Subject: [Tkinter-discuss] The wiki -- spammers and permission to edit In-Reply-To: <20090302171256.GB7841@unpythonic.net> References: <20090302171256.GB7841@unpythonic.net> Message-ID: <49AC5A4E.9040803@codebykevin.com> > > I'm sorry for the inconvenience this will cause for everyone who would > like to contribute to the wiki. > Jeff, I'm sorry that these measures are necessary too, but the spam appears to be out of control--this is a prudent response to that. Thanks for all you to do keep the wiki running--it's an invaluable resource. Best, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From madhu.subramaniam at gmail.com Tue Mar 3 17:09:21 2009 From: madhu.subramaniam at gmail.com (Madhu Subramaniam) Date: Tue, 3 Mar 2009 17:09:21 +0100 Subject: [Tkinter-discuss] Tkinter: window manager- .resizable Message-ID: <8e794c8a0903030809j6b3f3f3cw2fdeb1d5029af61d@mail.gmail.com> Hello, I work with python 2.5.2 and i use Tkinter for a gui app development. Platform with which i work is:- Linux version 2.6.9-67.ELsmp ( brewbuilder at hs20-bc1-5.build.redhat.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-8))** #!/usr/local/bin/python #---------------------- from Tkinter import * import pdb import os import string import threading from tkFileDialog import * from tkMessageBox import * import sys main_w = Tk() main_w.resizable(width = False, height = False) #main_w.maxsize(width= 1000, height = 3000) print main_w.resizable() main_w.mainloop() In the above code the command main_w.resizable.... does not work. That means, the user can drag the window to a larger size but cannot make the same smaller. On printing: ------------- print main_w.resizable() i do get 0,0 as output! BUT, the resizable attribute works if i add the following line main_w.maxsize(width= 1000, height = 3000) where the values are random but should not be set to width = 0, height =0, in which case it (widget.resizable(width = False, height = False)) does not function. So is this a bug, or am i doing something wrong here ? :O Regards Thanks arms -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Tue Mar 3 20:06:54 2009 From: klappnase at web.de (Michael Lange) Date: Tue, 3 Mar 2009 20:06:54 +0100 Subject: [Tkinter-discuss] Tkinter: window manager- .resizable In-Reply-To: <8e794c8a0903030809j6b3f3f3cw2fdeb1d5029af61d@mail.gmail.com> References: <8e794c8a0903030809j6b3f3f3cw2fdeb1d5029af61d@mail.gmail.com> Message-ID: <20090303200654.b9f4b388.klappnase@web.de> On Tue, 3 Mar 2009 17:09:21 +0100 Madhu Subramaniam wrote: > Hello, > > I work with python 2.5.2 and i use Tkinter for a gui app development. > Platform with which i work is:- Linux version 2.6.9-67.ELsmp ( > brewbuilder at hs20-bc1-5.build.redhat.com) (gcc version 3.4.6 20060404 (Red > Hat 3.4.6-8))** > > #!/usr/local/bin/python > #---------------------- > from Tkinter import * > import pdb > import os > import string > import threading > from tkFileDialog import * > from tkMessageBox import * > import sys > > main_w = Tk() > main_w.resizable(width = False, height = False) > #main_w.maxsize(width= 1000, height = 3000) > print main_w.resizable() > main_w.mainloop() > > In the above code the command main_w.resizable.... does not work. That > means, the user can drag the window to a larger size but cannot make the > same smaller. > > On printing: > ------------- > print main_w.resizable() > > i do get 0,0 as output! > > BUT, the resizable attribute works if i add the following line > main_w.maxsize(width= 1000, height = 3000) > where the values are random but should not be set to width = 0, height =0, > in which case it (widget.resizable(width = False, height = False)) does not > function. > > > So is this a bug, or am i doing something wrong here ? :O > > Regards > Thanks > arms > I cannot verify this here (Python2.5.2 on debian etch). Which version of Tk and which Wm do you use? Michael From ggpolo at gmail.com Tue Mar 3 20:55:02 2009 From: ggpolo at gmail.com (Guilherme Polo) Date: Tue, 3 Mar 2009 16:55:02 -0300 Subject: [Tkinter-discuss] Tkinter: window manager- .resizable In-Reply-To: <8e794c8a0903030809j6b3f3f3cw2fdeb1d5029af61d@mail.gmail.com> References: <8e794c8a0903030809j6b3f3f3cw2fdeb1d5029af61d@mail.gmail.com> Message-ID: On Tue, Mar 3, 2009 at 1:09 PM, Madhu Subramaniam wrote: > Hello, > > I work with python 2.5.2 and i use Tkinter for a gui app development. > Platform with which i work is:- Linux version 2.6.9-67.ELsmp > (brewbuilder at hs20-bc1-5.build.redhat.com) (gcc version 3.4.6 20060404 (Red > Hat 3.4.6-8)) > > #!/usr/local/bin/python > #---------------------- > from Tkinter import * > import pdb > import os > import string > import threading > from tkFileDialog import * > from tkMessageBox import * > import sys > > main_w = Tk() > main_w.resizable(width = False, height = False) > #main_w.maxsize(width= 1000, height = 3000) > print main_w.resizable() > main_w.mainloop() > > In the above code the command main_w.resizable.... does not work. That > means, the user can drag the window to a larger size but cannot make the > same smaller. > > On printing: > ------------- > print main_w.resizable() > > i do get 0,0 as output! Note that "resizable" is an alias to wm_resizable. All these methods starting with wm_ actually mean: "Please window manager, can you, if you don't mind, and if you are feeling like a good wm, do this favor -- insert favor here -- for this window? Please ?". And there is no guarantee that every wm will answer "yes". > > BUT,? the resizable attribute works? if i add the following line > main_w.maxsize(width= 1000, height = 3000) > where the values are random but should not be set to width = 0, height =0, > in which case it (widget.resizable(width = False, height = False)) does not > function. > > > So is this a bug, or am i doing something wrong here ? :O > > Regards > Thanks > arms > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- -- Guilherme H. Polo Goncalves From iain at day-online.org.uk.invalid Mon Mar 16 22:50:24 2009 From: iain at day-online.org.uk.invalid (Iain Day) Date: Mon, 16 Mar 2009 21:50:24 +0000 Subject: [Tkinter-discuss] Filling a series of tk.Label Message-ID: Hi, I've written a short program which is supposed to populate a table constructed from tk.Label widgets. It does this by looping over the rows. Unfortunately, it only seems to populate the final row. What am I doing wrong? The code is: def updatedata(): updatetime.delete(0, tk.END) for i in range(len(machines)): print machines[i] status = sshshowstat(machines[i]) for j in range(len(status)): param, value = status[j].split(': ') for k in range(len(variables)): if re.match(variables[k], param) is None: continue else: # print i, value if value in ('Acquiring', 'Regulated'): systemdata[i][k].config(text=value, foreground='green') elif value in ('Not Reg.'): systemdata[i][k].config(text=value, foreground='red') else: systemdata[i][k].config(text=value) tk.Button(root, text="Update Table Data", command=updatedata).grid(row=len(machines)+1, column=len(variables), sticky=tk.S) Thanks, Iain From michael.odonnell at uam.es Tue Mar 17 09:55:22 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Tue, 17 Mar 2009 09:55:22 +0100 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: References: Message-ID: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> Iain, You code is incomplete, the place where you create the Label widgets is not included. We need that to see the problem. Check the grid operation on each Label, in particular the row parameter. Also, do a print as each Label is gridded, to see if they all are actually created. Mick On Mon, Mar 16, 2009 at 10:50 PM, Iain Day wrote: > Hi, > > I've written a short program which is supposed to populate a table > constructed from tk.Label widgets. It does this by looping over the rows. > Unfortunately, it only seems to populate the final row. What am I doing > wrong? > > The code is: > > def updatedata(): > ? ?updatetime.delete(0, tk.END) > ? ?for i in range(len(machines)): > ? ? ? ?print machines[i] > ? ? ? ?status = sshshowstat(machines[i]) > > ? ? ? ?for j in range(len(status)): > ? ? ? ? ? ?param, value = status[j].split(': ') > > ? ? ? ? ? ?for k in range(len(variables)): > ? ? ? ? ? ? ? ?if re.match(variables[k], param) is None: > ? ? ? ? ? ? ? ? ? ?continue > ? ? ? ? ? ? ? ?else: > # ? ? ? ? ? ? ? ? ? ?print i, value > ? ? ? ? ? ? ? ? ? ?if value in ('Acquiring', 'Regulated'): > ? ? ? ? ? ? ? ? ? ? ? ?systemdata[i][k].config(text=value, > foreground='green') > ? ? ? ? ? ? ? ? ? ?elif value in ('Not Reg.'): > ? ? ? ? ? ? ? ? ? ? ? ?systemdata[i][k].config(text=value, foreground='red') > ? ? ? ? ? ? ? ? ? ?else: > ? ? ? ? ? ? ? ? ? ? ? ?systemdata[i][k].config(text=value) > > > tk.Button(root, text="Update Table Data", > command=updatedata).grid(row=len(machines)+1, column=len(variables), > sticky=tk.S) > > > > Thanks, > > Iain > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > From iain at day-online.org.uk.invalid Tue Mar 17 19:26:17 2009 From: iain at day-online.org.uk.invalid (Iain Day) Date: Tue, 17 Mar 2009 18:26:17 +0000 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> References: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> Message-ID: Sorry, here is the code that makes the label widgets: systemdata = [[0]*len(headers)]*len(machines) for i in range(len(machines)): for j in range(len(headers)): systemdata[i][j] = tk.Label(root, text=' ') systemdata[i][j].grid(row=i+1, column=j+1) If I do the following: systemdata[1][2].config(text='Test') It puts "Test" into position [2][2] rather than [1][2]. It appears to only "see" the last row ([2]). Iain Michael O'Donnell wrote: > Iain, > > You code is incomplete, the place where you create the Label widgets > is not included. We need that to see the problem. > > Check the grid operation on each Label, in particular the row parameter. > > Also, do a print as each Label is gridded, to see if they all are > actually created. > > Mick > > On Mon, Mar 16, 2009 at 10:50 PM, Iain Day > wrote: >> Hi, >> >> I've written a short program which is supposed to populate a table >> constructed from tk.Label widgets. It does this by looping over the rows. >> Unfortunately, it only seems to populate the final row. What am I doing >> wrong? >> >> The code is: >> >> def updatedata(): >> updatetime.delete(0, tk.END) >> for i in range(len(machines)): >> print machines[i] >> status = sshshowstat(machines[i]) >> >> for j in range(len(status)): >> param, value = status[j].split(': ') >> >> for k in range(len(variables)): >> if re.match(variables[k], param) is None: >> continue >> else: >> # print i, value >> if value in ('Acquiring', 'Regulated'): >> systemdata[i][k].config(text=value, >> foreground='green') >> elif value in ('Not Reg.'): >> systemdata[i][k].config(text=value, foreground='red') >> else: >> systemdata[i][k].config(text=value) >> >> >> tk.Button(root, text="Update Table Data", >> command=updatedata).grid(row=len(machines)+1, column=len(variables), >> sticky=tk.S) >> >> >> >> Thanks, >> >> Iain >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> From madhu.subramaniam at gmail.com Tue Mar 17 20:44:26 2009 From: madhu.subramaniam at gmail.com (Madhu Subramaniam) Date: Tue, 17 Mar 2009 20:44:26 +0100 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> References: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> Message-ID: <8e794c8a0903171244u2849604cx8d0e42250d241f17@mail.gmail.com> Iain, I made a small test program (Fairly new in Tkinter), i have not found the solution but i came across something, maybe somebody can throw more light on this ? Test Code (Active Python IDE 2.6 , Windows XP, Tkinter 8.4) import sys import pdb from Tkinter import * headers='ll' machines= 'zt' lbl = [[0]*len(headers)]*len(machines) flag=0 root = Tk() for i in range(len(machines)): for j in range(len(headers)): lbl[i][j] = Label(root, text= str(i)+str(j), bg = 'red') lbl[i][j].grid(row=i, column=j, padx=10, pady =5) *print lbl # something that was noticed* #print lbl[0][1] lbl[0][0].config(text= 'row=0, column=0') # changes the text in lbl [1] [0] lbl[0][1].config(text= 'row=0, column=1') # changes the text in lbl [1] [0] lbl[1][0].config(text= 'row=1, column=0')# overwrites the text in lbl [1] [0] lbl[1][1].config(text= 'row=1, column=1') # overwrites the text in lbl [1] [0] root.mainloop() *OUTPUT* >>> [[, ], [, ]] The instances generated in row wise are the same, but within a row they are different... something more can be learnt from that?? hmm, i got to leave now. Thanks Madhu On Tue, Mar 17, 2009 at 9:55 AM, Michael O'Donnell wrote: > Iain, > > You code is incomplete, the place where you create the Label widgets > is not included. We need that to see the problem. > > Check the grid operation on each Label, in particular the row parameter. > > Also, do a print as each Label is gridded, to see if they all are > actually created. > > Mick > > On Mon, Mar 16, 2009 at 10:50 PM, Iain Day > wrote: > > Hi, > > > > I've written a short program which is supposed to populate a table > > constructed from tk.Label widgets. It does this by looping over the rows. > > Unfortunately, it only seems to populate the final row. What am I doing > > wrong? > > > > The code is: > > > > def updatedata(): > > updatetime.delete(0, tk.END) > > for i in range(len(machines)): > > print machines[i] > > status = sshshowstat(machines[i]) > > > > for j in range(len(status)): > > param, value = status[j].split(': ') > > > > for k in range(len(variables)): > > if re.match(variables[k], param) is None: > > continue > > else: > > # print i, value > > if value in ('Acquiring', 'Regulated'): > > systemdata[i][k].config(text=value, > > foreground='green') > > elif value in ('Not Reg.'): > > systemdata[i][k].config(text=value, > foreground='red') > > else: > > systemdata[i][k].config(text=value) > > > > > > tk.Button(root, text="Update Table Data", > > command=updatedata).grid(row=len(machines)+1, column=len(variables), > > sticky=tk.S) > > > > > > > > Thanks, > > > > Iain > > > > _______________________________________________ > > Tkinter-discuss mailing list > > Tkinter-discuss at python.org > > http://mail.python.org/mailman/listinfo/tkinter-discuss > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Tue Mar 17 21:33:32 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Tue, 17 Mar 2009 21:33:32 +0100 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: <8e794c8a0903171244u2849604cx8d0e42250d241f17@mail.gmail.com> References: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> <8e794c8a0903171244u2849604cx8d0e42250d241f17@mail.gmail.com> Message-ID: <47e491110903171333t495d837bm57547c949b1eb2e5@mail.gmail.com> Hi Madhu, This is not in fact a Tkinter problem. Try the following simplification of your code: lbl = [[0]*2]*2 for i in range(2): for j in range(2): lbl[i][j] = str(i)+str(j) print ">", i, j, lbl[i][j], lbl print lbl ------------------ The print statement within the loops shows that every time you change the first row of the "array", the other row changes as well. Try substituting the first line for: lbl=[[0,0], [0,0]] Then no problem, the code works as expected. So, I cannot explain why, but your way fo initialising the 'array' (in fact, a list of lists), seems to make a list of lists where the lists are in fact the same list. (I have never used '*' with lists, this may be the problem. Try instead an intialisation like: x=[[0 for i in range(2)] for j in range(3)] Mick On Tue, Mar 17, 2009 at 8:44 PM, Madhu Subramaniam wrote: > Iain, > > I made a small test program (Fairly new in Tkinter), i have not found the > solution but i came across something, maybe somebody can throw more light on > this ? > > Test Code (Active Python IDE 2.6 , Windows XP, Tkinter 8.4) > > import sys > import pdb > from Tkinter import * > headers='ll' > machines= 'zt' > lbl = [[0]*len(headers)]*len(machines) > flag=0 > root = Tk() > for i in range(len(machines)): > ?? for j in range(len(headers)): > ??? lbl[i][j] = Label(root, text= str(i)+str(j), bg = 'red') > ??? lbl[i][j].grid(row=i, column=j, padx=10, pady =5) > print lbl # something that was noticed > #print lbl[0][1] > lbl[0][0].config(text= 'row=0, column=0') # changes the text in lbl [1] [0] > lbl[0][1].config(text= 'row=0, column=1') # changes the text in lbl [1] [0] > lbl[1][0].config(text= 'row=1, column=0')# overwrites the text in lbl [1] > [0] > lbl[1][1].config(text= 'row=1, column=1') # overwrites the text in lbl [1] > [0] > root.mainloop() > > OUTPUT >>>> [[, >>> 0x012B3AA8>], [, >>> instance at 0x012B3AA8>]] > > The instances generated in row wise are the same, but within a row they are > different... > something more can be learnt from that?? hmm, i got to leave now. > > Thanks > Madhu > > On Tue, Mar 17, 2009 at 9:55 AM, Michael O'Donnell > wrote: >> >> Iain, >> >> ?You code is incomplete, the place where you create the Label widgets >> is not included. We need that to see the problem. >> >> Check the grid operation on each Label, in particular the row parameter. >> >> Also, do a print as each Label is gridded, to see if they all are >> actually created. >> >> Mick >> >> On Mon, Mar 16, 2009 at 10:50 PM, Iain Day >> wrote: >> > Hi, >> > >> > I've written a short program which is supposed to populate a table >> > constructed from tk.Label widgets. It does this by looping over the >> > rows. >> > Unfortunately, it only seems to populate the final row. What am I doing >> > wrong? >> > >> > The code is: >> > >> > def updatedata(): >> > ? ?updatetime.delete(0, tk.END) >> > ? ?for i in range(len(machines)): >> > ? ? ? ?print machines[i] >> > ? ? ? ?status = sshshowstat(machines[i]) >> > >> > ? ? ? ?for j in range(len(status)): >> > ? ? ? ? ? ?param, value = status[j].split(': ') >> > >> > ? ? ? ? ? ?for k in range(len(variables)): >> > ? ? ? ? ? ? ? ?if re.match(variables[k], param) is None: >> > ? ? ? ? ? ? ? ? ? ?continue >> > ? ? ? ? ? ? ? ?else: >> > # ? ? ? ? ? ? ? ? ? ?print i, value >> > ? ? ? ? ? ? ? ? ? ?if value in ('Acquiring', 'Regulated'): >> > ? ? ? ? ? ? ? ? ? ? ? ?systemdata[i][k].config(text=value, >> > foreground='green') >> > ? ? ? ? ? ? ? ? ? ?elif value in ('Not Reg.'): >> > ? ? ? ? ? ? ? ? ? ? ? ?systemdata[i][k].config(text=value, >> > foreground='red') >> > ? ? ? ? ? ? ? ? ? ?else: >> > ? ? ? ? ? ? ? ? ? ? ? ?systemdata[i][k].config(text=value) >> > >> > >> > tk.Button(root, text="Update Table Data", >> > command=updatedata).grid(row=len(machines)+1, column=len(variables), >> > sticky=tk.S) >> > >> > >> > >> > Thanks, >> > >> > Iain >> > >> > _______________________________________________ >> > Tkinter-discuss mailing list >> > Tkinter-discuss at python.org >> > http://mail.python.org/mailman/listinfo/tkinter-discuss >> > >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss > > From iain at day-online.org.uk.invalid Tue Mar 17 21:40:02 2009 From: iain at day-online.org.uk.invalid (Iain Day) Date: Tue, 17 Mar 2009 20:40:02 +0000 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: <47e491110903171333t495d837bm57547c949b1eb2e5@mail.gmail.com> References: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> <8e794c8a0903171244u2849604cx8d0e42250d241f17@mail.gmail.com> <47e491110903171333t495d837bm57547c949b1eb2e5@mail.gmail.com> Message-ID: Great, thanks for that! Iain Michael O'Donnell wrote: > Hi Madhu, > > This is not in fact a Tkinter problem. > > Try the following simplification of your code: > > lbl = [[0]*2]*2 > for i in range(2): > for j in range(2): > lbl[i][j] = str(i)+str(j) > print ">", i, j, lbl[i][j], lbl > print lbl > > ------------------ > > The print statement within the loops shows that > every time you change the first row of the "array", > the other row changes as well. > > Try substituting the first line for: > > lbl=[[0,0], [0,0]] > > > Then no problem, the code works as expected. > > So, I cannot explain why, but your way fo initialising the > 'array' (in fact, a list of lists), seems to make a list of > lists where the lists are in fact the same list. > (I have never used '*' with lists, this may be the > problem. > > Try instead an intialisation like: > > x=[[0 for i in range(2)] for j in range(3)] > > Mick > > > > > > On Tue, Mar 17, 2009 at 8:44 PM, Madhu Subramaniam > wrote: >> Iain, >> >> I made a small test program (Fairly new in Tkinter), i have not found the >> solution but i came across something, maybe somebody can throw more light on >> this ? >> >> Test Code (Active Python IDE 2.6 , Windows XP, Tkinter 8.4) >> >> import sys >> import pdb >> from Tkinter import * >> headers='ll' >> machines= 'zt' >> lbl = [[0]*len(headers)]*len(machines) >> flag=0 >> root = Tk() >> for i in range(len(machines)): >> for j in range(len(headers)): >> lbl[i][j] = Label(root, text= str(i)+str(j), bg = 'red') >> lbl[i][j].grid(row=i, column=j, padx=10, pady =5) >> print lbl # something that was noticed >> #print lbl[0][1] >> lbl[0][0].config(text= 'row=0, column=0') # changes the text in lbl [1] [0] >> lbl[0][1].config(text= 'row=0, column=1') # changes the text in lbl [1] [0] >> lbl[1][0].config(text= 'row=1, column=0')# overwrites the text in lbl [1] >> [0] >> lbl[1][1].config(text= 'row=1, column=1') # overwrites the text in lbl [1] >> [0] >> root.mainloop() >> >> OUTPUT >>>>> [[, >>>> 0x012B3AA8>], [, >>>> instance at 0x012B3AA8>]] >> The instances generated in row wise are the same, but within a row they are >> different... >> something more can be learnt from that?? hmm, i got to leave now. >> >> Thanks >> Madhu >> >> On Tue, Mar 17, 2009 at 9:55 AM, Michael O'Donnell >> wrote: >>> Iain, >>> >>> You code is incomplete, the place where you create the Label widgets >>> is not included. We need that to see the problem. >>> >>> Check the grid operation on each Label, in particular the row parameter. >>> >>> Also, do a print as each Label is gridded, to see if they all are >>> actually created. >>> >>> Mick >>> >>> On Mon, Mar 16, 2009 at 10:50 PM, Iain Day >>> wrote: >>>> Hi, >>>> >>>> I've written a short program which is supposed to populate a table >>>> constructed from tk.Label widgets. It does this by looping over the >>>> rows. >>>> Unfortunately, it only seems to populate the final row. What am I doing >>>> wrong? >>>> >>>> The code is: >>>> >>>> def updatedata(): >>>> updatetime.delete(0, tk.END) >>>> for i in range(len(machines)): >>>> print machines[i] >>>> status = sshshowstat(machines[i]) >>>> >>>> for j in range(len(status)): >>>> param, value = status[j].split(': ') >>>> >>>> for k in range(len(variables)): >>>> if re.match(variables[k], param) is None: >>>> continue >>>> else: >>>> # print i, value >>>> if value in ('Acquiring', 'Regulated'): >>>> systemdata[i][k].config(text=value, >>>> foreground='green') >>>> elif value in ('Not Reg.'): >>>> systemdata[i][k].config(text=value, >>>> foreground='red') >>>> else: >>>> systemdata[i][k].config(text=value) >>>> >>>> >>>> tk.Button(root, text="Update Table Data", >>>> command=updatedata).grid(row=len(machines)+1, column=len(variables), >>>> sticky=tk.S) >>>> >>>> >>>> >>>> Thanks, >>>> >>>> Iain >>>> >>>> _______________________________________________ >>>> Tkinter-discuss mailing list >>>> Tkinter-discuss at python.org >>>> http://mail.python.org/mailman/listinfo/tkinter-discuss >>>> >>> _______________________________________________ >>> Tkinter-discuss mailing list >>> Tkinter-discuss at python.org >>> http://mail.python.org/mailman/listinfo/tkinter-discuss >> From michael.odonnell at uam.es Tue Mar 17 21:36:42 2009 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Tue, 17 Mar 2009 21:36:42 +0100 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: <47e491110903171333t495d837bm57547c949b1eb2e5@mail.gmail.com> References: <47e491110903170155o14d0a2c8rd1ec28abb7ac6999@mail.gmail.com> <8e794c8a0903171244u2849604cx8d0e42250d241f17@mail.gmail.com> <47e491110903171333t495d837bm57547c949b1eb2e5@mail.gmail.com> Message-ID: <47e491110903171336r566934c1r5b7bcadc0aa0d25@mail.gmail.com> >From the Python Documentation on using * with a list: Note also that the copies are shallow; nested structures are not copied. This often haunts new Python programmers; consider: >>> lists = [[]] * 3 >>> lists [[], [], []] >>> lists[0].append(3) >>> lists [[3], [3], [3]] What has happened is that [[]] is a one-element list containing an empty list, so all three elements of [[]] * 3 are (pointers to) this single empty list. Modifying any of the elements of lists modifies this single list. You can create a list of different lists this way: >>> lists = [[] for i in range(3)] >>> lists[0].append(3) >>> lists[1].append(5) >>> lists[2].append(7) >>> lists [[3], [5], [7]] From pdhartley at gmail.com Thu Mar 19 09:24:39 2009 From: pdhartley at gmail.com (jimscafe) Date: Thu, 19 Mar 2009 01:24:39 -0700 (PDT) Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: References: Message-ID: <22595082.post@talk.nabble.com> I hope the problem has been solved for you. I found your message because I was searching the internet for my own solution. I am doing the exact same as you, creating a grid of labels. How do you plan to scroll horizontally if the number of columns in the data exceeds the number displayed? I decided to use the Scale widget, it works but a scrollbar would be better. I just couldn't figure out how to use the scrollbar - it seems that it needs to be attached to a frame or similar, then how do you set the values? This is easy in a Scale, but it doesn't look as good. I also named the labels that displayed the data so that I could easily identify when a user clicks on a label, which cell they had chosen. I want to let them drill down on the data in a cell (the application is for monthly financial data). Iain Day wrote: > > Hi, > > I've written a short program which is supposed to populate a table > constructed from tk.Label widgets. It does this by looping over the > rows. Unfortunately, it only seems to populate the final row. What am I > doing wrong? > > The code is: > > def updatedata(): > updatetime.delete(0, tk.END) > for i in range(len(machines)): > print machines[i] > status = sshshowstat(machines[i]) > > for j in range(len(status)): > param, value = status[j].split(': ') > > for k in range(len(variables)): > if re.match(variables[k], param) is None: > continue > else: > # print i, value > if value in ('Acquiring', 'Regulated'): > systemdata[i][k].config(text=value, > foreground='green') > elif value in ('Not Reg.'): > systemdata[i][k].config(text=value, > foreground='red') > else: > systemdata[i][k].config(text=value) > > > tk.Button(root, text="Update Table Data", > command=updatedata).grid(row=len(machines)+1, column=len(variables), > sticky=tk.S) > > > > Thanks, > > Iain > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/Filling-a-series-of-tk.Label-tp22548194p22595082.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From pdhartley at gmail.com Thu Mar 19 09:42:34 2009 From: pdhartley at gmail.com (jimscafe) Date: Thu, 19 Mar 2009 01:42:34 -0700 (PDT) Subject: [Tkinter-discuss] From wxPython to TK Message-ID: <22595091.post@talk.nabble.com> I am a businessman who writes his own software to help run the business. That said I started writing software in Fortran on an ICL mainframe, then on a Commodore pet, then an Apple II. I gravitated towards Python some 6 years ago (via java and perl) and enjoy Python. The gui is another matter. I tried TK at first then for the last 3 years have been using wxPython - I bought a book on it as I find the documentation difficult, not to say irritating at times. This week I decided to try and go back to TK, so I have been writing demo code to make sure that I have the necessary tools to complete the few main applications I already have that use a gui. The frustration with wx is mainly little niggles. There is no doubt it is a wonderful package, but I just find the niggles more and more drustrating. For example, I have decided to try to use linux as my development desktop (mint linux). I like it a lot (from XP) but my finance software needs to be altered a lot using wx - partly it is font problems, but even installing Windows fonts on mint did not solve the display problems. The final problem was the combo box, which behaves differently on Windows and linux and which in the forums I searched there was no satisfactory answer as to how to fix it or why there was a difference. Hence I thought I would go back to basics. My first task was to create a grid widget to display my monthly data by orders, invoices etc. I did this using a grid of labels. A combo box is an OptionMenu(took some time to figure this out satisfactorily). To the more experienced (i.e. people who program for a living), is using tk a sensible decision? I looked at other gui options, but all seemed complicated and not necessarily well documented online. Where am I likely to come across things I need to do that will be impossible in tk (if any)? I have just spent about 10 hours writing demo code in tk and I think I can cover all the applications I have developed in wx. This might take me a week - not really many applications currently in use. And I do feel there is more control in tk over the widget. Not quite sure what I mean by this but because the widgets are more basic it seems easier to use them and then develop them further. My main monthly report I have used the model-view-control approach, so only the view part needs changing. There doesn't seem to be much development going on in tk, is this a potential future problem? Any comments will be much appreciated. -- View this message in context: http://www.nabble.com/From-wxPython-to-TK-tp22595091p22595091.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From Cameron at phaseit.net Thu Mar 19 09:55:20 2009 From: Cameron at phaseit.net (Cameron Laird) Date: Thu, 19 Mar 2009 08:55:20 +0000 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <22595091.post@talk.nabble.com> References: <22595091.post@talk.nabble.com> Message-ID: <20090319085520.GA16250@lairds.us> On Thu, Mar 19, 2009 at 01:42:34AM -0700, jimscafe wrote: . . . > There doesn't seem to be much development going on in tk, is this a > potential future problem? . . . There is an abundance of development with and in Tk; it's not publicized well, though. Tk's market position *is* a potential problem, though. What's most certain is that there are large, well-entrenched mission-critical Tk-based applications that will still be in use (building aircraft, designing semiconductors and automobiles, charting hurricanes, ...) a decade from now. From ggpolo at gmail.com Thu Mar 19 11:25:05 2009 From: ggpolo at gmail.com (Guilherme Polo) Date: Thu, 19 Mar 2009 07:25:05 -0300 Subject: [Tkinter-discuss] Filling a series of tk.Label In-Reply-To: <22595082.post@talk.nabble.com> References: <22595082.post@talk.nabble.com> Message-ID: On Thu, Mar 19, 2009 at 5:24 AM, jimscafe wrote: > > I hope the problem has been solved for you. > > I found your message because I was searching the internet for my own > solution. I am doing the exact same as you, creating a grid of labels. > > How do you plan to scroll horizontally if the number of columns in the data > exceeds the number displayed? > > I decided to use the Scale widget, it works but a scrollbar would be better. > I just couldn't figure out how to use the scrollbar - it seems that it needs > to be attached to a frame or similar, then how do you set the values? This > is easy in a Scale, but it doesn't look as good. > > I also named the labels that displayed the data so that I could easily > identify when a user clicks on a label, which cell they had chosen. I want > to let them drill down on the data in a cell (the application is for monthly > financial data). > > > Sorry if this isn't an option for you both but.. have you considered using the tktable widget instead ? -- -- Guilherme H. Polo Goncalves From kw at codebykevin.com Thu Mar 19 14:24:20 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Thu, 19 Mar 2009 09:24:20 -0400 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <22595091.post@talk.nabble.com> References: <22595091.post@talk.nabble.com> Message-ID: <49C24784.9020206@codebykevin.com> jimscafe wrote: > > To the more experienced (i.e. people who program for a living), is using tk > a sensible decision? I looked at other gui options, but all seemed > complicated and not necessarily well documented online. > Where am I likely to come across things I need to do that will be impossible > in tk (if any)? Wx has a few things that Tk does not. Tk lacks an adequate cross-platform implementation of drag-and-drop and printing, for instance. There are extensions for these things, but not all of them have Python wrappers, and they don't work on all platforms. That said, for most things Tk--either by itself or with extensions--is more than adequate. > There doesn't seem to be much development going on in tk, is this a > potential future problem? Tk has actually had a huge number of advances in the past few years: themed widgets, new widgets such as a tree and table view, and more. These have started first in the Tcl/Tk world, where Tk is developed, but these advances are moving out into other languages with Tk bindings. I would say that Tk is now on par with the other major toolkits, apart from the issues noted above. This site is a good overview to the state-of-the-art in Tk: http://www.tkdocs.com/ Here's the site that documents the effort to integrate these things into Python: http://gpolo.ath.cx:81/projects/pyttk/ --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From timj at tolisgroup.com Thu Mar 19 16:51:38 2009 From: timj at tolisgroup.com (Tim Jones) Date: Thu, 19 Mar 2009 08:51:38 -0700 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <22595091.post@talk.nabble.com> References: <22595091.post@talk.nabble.com> Message-ID: <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> On Mar 19, 2009, at 1:42 AM, jimscafe wrote: > I am a businessman who writes his own software to help run the > business. That > said I started writing software in Fortran on an ICL mainframe, > then on a > Commodore pet, then an Apple II. > > I gravitated towards Python some 6 years ago (via java and perl) > and enjoy > Python. > > The gui is another matter. I tried TK at first then for the last 3 > years > have been using wxPython - I bought a book on it as I find the > documentation > difficult, not to say irritating at times. Sorry to usurp the TK-ness of this thread, but have you taken a look at PyQT (http://www.riverbankcomputing.co.uk/software/pyqt/intro)? It's Python wrappers for the QT framework. Now that Nokia has removed the commercial limitations on the QT development environment, and since you're not writing commercial apps, the combination of PyQT and QT are free. QT's implementation is pretty solid across all platforms, but be aware that ANY cross-platform toolkit is going to see problems with the DPI setting differences between Windows (72 DPI default) and Linux X11 (72 to 99 DPI default). You really need to create your widgets in such a manner that things can be scaled based on your determination of the system's current DPI value. You can get the DPI value on Linux using "xdpyinfo | grep resolution" in a terminal. HTH, Tim From Cameron at phaseit.net Thu Mar 19 17:04:24 2009 From: Cameron at phaseit.net (Cameron Laird) Date: Thu, 19 Mar 2009 16:04:24 +0000 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> References: <22595091.post@talk.nabble.com> <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> Message-ID: <20090319160424.GB19692@lairds.us> On Thu, Mar 19, 2009 at 08:51:38AM -0700, Tim Jones wrote: . . . > Sorry to usurp the TK-ness of this thread, but have you taken a look > at PyQT (http://www.riverbankcomputing.co.uk/software/pyqt/intro)? > It's Python wrappers for the QT framework. Now that Nokia has > removed the commercial limitations on the QT development environment, > and since you're not writing commercial apps, the combination of PyQT > and QT are free. QT's implementation is pretty solid across all . . . Tim's absolutely right that Qt has a lot going for it. From timj at tolisgroup.com Thu Mar 19 17:19:21 2009 From: timj at tolisgroup.com (Tim Jones) Date: Thu, 19 Mar 2009 09:19:21 -0700 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> References: <22595091.post@talk.nabble.com> <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> Message-ID: <5B86A141-9CC5-49AF-AC57-6D3CFA745750@tolisgroup.com> On Mar 19, 2009, at 8:51 AM, Tim Jones wrote: > ...be aware that ANY cross-platform toolkit is going to see > problems with the DPI setting differences between Windows (72 DPI > default) and Linux X11 (72 to 99 DPI default). You really need to > create your widgets in such a manner that things can be scaled > based on your determination of the system's current DPI value. > > You can get the DPI value on Linux using "xdpyinfo | grep > resolution" in a terminal. I guess I should have reinforced that this is true for TCL/TK, Python/ Tkinter, and any other cross-platform framework. And, it's gotten worse on Linux over the last year or so as the distros have started to try harder to make their default installs look better under GNOME or KDE. It gets really troublesome when you're running Linux in a virtual machine on Windows as the DPMI responses to the X11 server are spotty. I've seen DPI values from 88 to 173 returned. While 88 is not too bad (the fonts get smaller), at 173, 10 point Helvetica is similar in physical size on the display as a 48 point font in Windows. So, you may want to carefully examine your code if you are working towards Windows and X11 (and OS X) support as the DPI values can torpedo your work. Tim From klappnase at web.de Fri Mar 20 12:10:02 2009 From: klappnase at web.de (Michael Lange) Date: Fri, 20 Mar 2009 12:10:02 +0100 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> References: <22595091.post@talk.nabble.com> <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> Message-ID: <20090320121002.fa04bd35.klappnase@web.de> On Thu, 19 Mar 2009 08:51:38 -0700 Tim Jones wrote: > > You can get the DPI value on Linux using "xdpyinfo | grep resolution" > in a terminal. > You can even do this from Tk, just type: dpi_value = root.winfo_fpixels('1i') (where "root" is your Tk() window) to get the currently used dpi value, or: root.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0) to adjust the dpi value to your needs (this should be done before creating any widgets besides the Tk() window though). Michael > HTH, > Tim > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss From timj at tolisgroup.com Fri Mar 20 16:35:35 2009 From: timj at tolisgroup.com (Tim Jones) Date: Fri, 20 Mar 2009 08:35:35 -0700 Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <20090320121002.fa04bd35.klappnase@web.de> References: <22595091.post@talk.nabble.com> <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> <20090320121002.fa04bd35.klappnase@web.de> Message-ID: <7BD059D4-C6D4-465C-A1BD-E74C227EA19E@tolisgroup.com> On Mar 20, 2009, at 4:10 AM, Michael Lange wrote: > On Thu, 19 Mar 2009 08:51:38 -0700 > Tim Jones wrote: > > > >> >> You can get the DPI value on Linux using "xdpyinfo | grep resolution" >> in a terminal. >> > > You can even do this from Tk, just type: > > dpi_value = root.winfo_fpixels('1i') > > (where "root" is your Tk() window) to get the currently used dpi > value, or: > > root.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0) > > to adjust the dpi value to your needs (this should be done before > creating any > widgets besides the Tk() window though). Outstanding! Instant scaling and our apps look correct. Thanks for the tip, Michael. Tim From yogendra_mohan at oxyent-medical.com Sat Mar 21 16:35:44 2009 From: yogendra_mohan at oxyent-medical.com (YMohan) Date: Sat, 21 Mar 2009 08:35:44 -0700 (PDT) Subject: [Tkinter-discuss] Problem facing in lift and tkraise urgent Message-ID: <22637232.post@talk.nabble.com> Hi All, I am facing the issues while using the lift or tkraise with create_window objects. its not working. I am trying to do the show one window at a time. I have created two window objects using the create_window and try to launch the first one. The following code I have written from Tkinter import * root = Tk() canvas = Canvas(root, width=300, height=300, bg='white') # 0,0 is top left corner canvas.pack(expand=YES, fill=BOTH) # increases down, right def setAbove(): canvas.tkraise(objectID1) # print "after tk raise" widget1 = Frame(canvas, bg='red', height=100, width=100) widget2 = Frame(canvas, bg='blue', height=100, width=100) objectID1=canvas.create_window(100, 100, window=widget1) # embed a widget objectID2=canvas.create_window(100, 100, window=widget2) # embed a widget root.after(5000, setAbove) root.mainloop() Let me know what am I doing wrong or any other way to do the same? Thanks in advance. YMohan -- View this message in context: http://www.nabble.com/Problem-facing-in-lift-and-tkraise-urgent-tp22637232p22637232.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From klappnase at web.de Sat Mar 21 19:44:20 2009 From: klappnase at web.de (Michael Lange) Date: Sat, 21 Mar 2009 19:44:20 +0100 Subject: [Tkinter-discuss] Problem facing in lift and tkraise urgent In-Reply-To: <22637232.post@talk.nabble.com> References: <22637232.post@talk.nabble.com> Message-ID: <20090321194420.ef913734.klappnase@web.de> On Sat, 21 Mar 2009 08:35:44 -0700 (PDT) YMohan wrote: > > Hi All, > > I am facing the issues while using the lift or tkraise with create_window > objects. its not working. I am trying to do the show one window at a time. I > have created two window objects using the create_window and try to launch > the first one. The following code I have written > > from Tkinter import * > root = Tk() > canvas = Canvas(root, width=300, height=300, bg='white') # 0,0 is top left > corner > canvas.pack(expand=YES, fill=BOTH) # increases down, right > > def setAbove(): > canvas.tkraise(objectID1) > # print "after tk raise" > > widget1 = Frame(canvas, bg='red', height=100, width=100) > widget2 = Frame(canvas, bg='blue', height=100, width=100) > objectID1=canvas.create_window(100, 100, window=widget1) # embed a > widget > objectID2=canvas.create_window(100, 100, window=widget2) # embed a > widget > root.after(5000, setAbove) > root.mainloop() > > Let me know what am I doing wrong or any other way to do the same? > >From the canvas man page: (...)the stacking order of window items is not affected by any of the canvas widget commands; you must use the raise and lower Tk commands instead. So the solution is to call widget1.lift() instead of canvas.tkraise(objectID1). HTH Michael > Thanks in advance. > > YMohan > > -- > View this message in context: http://www.nabble.com/Problem-facing-in-lift-and-tkraise-urgent-tp22637232p22637232.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 yogendra_mohan at oxyent-medical.com Sat Mar 21 21:08:03 2009 From: yogendra_mohan at oxyent-medical.com (YMohan) Date: Sat, 21 Mar 2009 13:08:03 -0700 (PDT) Subject: [Tkinter-discuss] Problem facing in lift and tkraise urgent In-Reply-To: <20090321194420.ef913734.klappnase@web.de> References: <22637232.post@talk.nabble.com> <20090321194420.ef913734.klappnase@web.de> Message-ID: <22639838.post@talk.nabble.com> Hello Michael, Thanks a lot for immediate reply. Your solution works. Regards Yogendra Mohan Michael Lange wrote: > > On Sat, 21 Mar 2009 08:35:44 -0700 (PDT) > YMohan wrote: > >> >> Hi All, >> >> I am facing the issues while using the lift or tkraise with create_window >> objects. its not working. I am trying to do the show one window at a >> time. I >> have created two window objects using the create_window and try to launch >> the first one. The following code I have written >> >> from Tkinter import * >> root = Tk() >> canvas = Canvas(root, width=300, height=300, bg='white') # 0,0 is top >> left >> corner >> canvas.pack(expand=YES, fill=BOTH) # increases down, >> right >> >> def setAbove(): >> canvas.tkraise(objectID1) >> # print "after tk raise" >> >> widget1 = Frame(canvas, bg='red', height=100, width=100) >> widget2 = Frame(canvas, bg='blue', height=100, width=100) >> objectID1=canvas.create_window(100, 100, window=widget1) # embed a >> widget >> objectID2=canvas.create_window(100, 100, window=widget2) # embed a >> widget >> root.after(5000, setAbove) >> root.mainloop() >> >> Let me know what am I doing wrong or any other way to do the same? >> > >>From the canvas man page: > > (...)the stacking order of window items is not affected by any of the > canvas widget commands; you must use the raise and lower Tk commands > instead. > > So the solution is to call widget1.lift() instead of > canvas.tkraise(objectID1). > > HTH > > Michael > > >> Thanks in advance. >> >> YMohan >> >> -- >> View this message in context: >> http://www.nabble.com/Problem-facing-in-lift-and-tkraise-urgent-tp22637232p22637232.html >> Sent from the Python - tkinter-discuss mailing list archive at >> Nabble.com. >> >> _______________________________________________ >> Tkinter-discuss mailing list >> Tkinter-discuss at python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/Problem-facing-in-lift-and-tkraise-urgent-tp22637232p22639838.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From pdhartley at gmail.com Mon Mar 23 05:08:27 2009 From: pdhartley at gmail.com (jimscafe) Date: Sun, 22 Mar 2009 21:08:27 -0700 (PDT) Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <49C24784.9020206@codebykevin.com> References: <22595091.post@talk.nabble.com> <49C24784.9020206@codebykevin.com> Message-ID: <22654059.post@talk.nabble.com> The ability to print reports is certainly an asset of wx... though I don't find the need to print is as prevalent as it used to be. Kevin Walzer-5 wrote: > > jimscafe wrote: > >> >> To the more experienced (i.e. people who program for a living), is using >> tk >> a sensible decision? I looked at other gui options, but all seemed >> complicated and not necessarily well documented online. >> Where am I likely to come across things I need to do that will be >> impossible >> in tk (if any)? > > Wx has a few things that Tk does not. Tk lacks an adequate > cross-platform implementation of drag-and-drop and printing, for > instance. There are extensions for these things, but not all of them > have Python wrappers, and they don't work on all platforms. > > That said, for most things Tk--either by itself or with extensions--is > more than adequate. > > >> There doesn't seem to be much development going on in tk, is this a >> potential future problem? > > Tk has actually had a huge number of advances in the past few years: > themed widgets, new widgets such as a tree and table view, and more. > These have started first in the Tcl/Tk world, where Tk is developed, but > these advances are moving out into other languages with Tk bindings. I > would say that Tk is now on par with the other major toolkits, apart > from the issues noted above. > > This site is a good overview to the state-of-the-art in Tk: > http://www.tkdocs.com/ > > Here's the site that documents the effort to integrate these things into > Python: http://gpolo.ath.cx:81/projects/pyttk/ > > --Kevin > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/From-wxPython-to-TK-tp22595091p22654059.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From pdhartley at gmail.com Mon Mar 23 05:11:46 2009 From: pdhartley at gmail.com (jimscafe) Date: Sun, 22 Mar 2009 21:11:46 -0700 (PDT) Subject: [Tkinter-discuss] From wxPython to TK In-Reply-To: <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> References: <22595091.post@talk.nabble.com> <15AFC490-8B51-479F-A854-BFF5818DD12A@tolisgroup.com> Message-ID: <22654088.post@talk.nabble.com> I will look at QT, I see there is a book on QT4 in Amazon which would get me started. Previously the Windows license put me off QT but I understand that has changed now. It isn't only the font problem but behavious for some wx widgets is different too (and odd on linux for the combo box) Tim Jones-8 wrote: > > On Mar 19, 2009, at 1:42 AM, jimscafe wrote: > >> I am a businessman who writes his own software to help run the >> business. That >> said I started writing software in Fortran on an ICL mainframe, >> then on a >> Commodore pet, then an Apple II. >> >> I gravitated towards Python some 6 years ago (via java and perl) >> and enjoy >> Python. >> >> The gui is another matter. I tried TK at first then for the last 3 >> years >> have been using wxPython - I bought a book on it as I find the >> documentation >> difficult, not to say irritating at times. > > Sorry to usurp the TK-ness of this thread, but have you taken a look > at PyQT (http://www.riverbankcomputing.co.uk/software/pyqt/intro)? > It's Python wrappers for the QT framework. Now that Nokia has > removed the commercial limitations on the QT development environment, > and since you're not writing commercial apps, the combination of PyQT > and QT are free. QT's implementation is pretty solid across all > platforms, but be aware that ANY cross-platform toolkit is going to > see problems with the DPI setting differences between Windows (72 DPI > default) and Linux X11 (72 to 99 DPI default). You really need to > create your widgets in such a manner that things can be scaled based > on your determination of the system's current DPI value. > > You can get the DPI value on Linux using "xdpyinfo | grep resolution" > in a terminal. > > HTH, > Tim > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > -- View this message in context: http://www.nabble.com/From-wxPython-to-TK-tp22595091p22654088.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From Allen.Taylor at mdacorporation.com Wed Mar 25 21:00:41 2009 From: Allen.Taylor at mdacorporation.com (Allen Taylor) Date: Wed, 25 Mar 2009 16:00:41 -0400 Subject: [Tkinter-discuss] Announcement: Tka11y 0.1.1 release - Accessibility-aware Tkinter Message-ID: <49CA5529.FA48.005C.0@mdacorporation.com> Tka11y 0.1.1 is released. You can find it at http://pypi.python.org/pypi/Tka11y. Changes from 0.1.0 to 0.1.1: - Added emission of text, text attribute, value, and selection changes. - This enhancement is based on proposed changes to Papi, and therefore will not be realized until a new version of Papi (> 0.0.9) is released. - Fixed reporting of text background color attribute for Entry and Spinbox widgets in the readonly state. - Fixed some value interface bugs in Scale and Scrollbar. - Fixed selection interface bugs in Listbox. - Ensured Entry and Spinbox widgets have an empty name. In the previous version, the name was assigned the initial text contents of the widget, which didn't make much sense. - Made some other minor bug fixes. >From the package description... This module makes it possible for accessibility (a11y) clients (e.g., audible readers, magnifiers, etc.) to get accessibility data (name, description, role, actions, etc.) from the Tk widgets of Python applications that use Tkinter. It also allows automated GUI application testers that use the accessibility interface (such as dogtail, LDTP, and Accerciser) to control the Tk widgets of these applications. Currently, accessibility is only available via ATK <=> AT-SPI on Linux. Sorry, no Windows MSAA support. Enjoy! Allen B. Taylor -------------- next part -------------- An HTML attachment was scrubbed... URL: From sierra_mtnview at sbcglobal.net Thu Mar 26 16:51:40 2009 From: sierra_mtnview at sbcglobal.net (Wayne Watson) Date: Thu, 26 Mar 2009 08:51:40 -0700 Subject: [Tkinter-discuss] Tkinter Geometry Management and Other Basics Message-ID: <49CBA48C.4020601@sbcglobal.net> An HTML attachment was scrubbed... URL: From yogendra_mohan at oxyent-medical.com Sat Mar 28 10:28:47 2009 From: yogendra_mohan at oxyent-medical.com (YMohan) Date: Sat, 28 Mar 2009 02:28:47 -0700 (PDT) Subject: [Tkinter-discuss] Facing issue to show the default button Selected on MAC OS - urgent Message-ID: <22755049.post@talk.nabble.com> Hi All, I am using MAC OS 10.5.1 and Python 2.5.1. I want to show the defalut selected button in Tk window. I have two buttons OK and CANCEL. I want to show the by default OK Button selected but I am not able to do the same on MAC environment. The same code works in Windows. I have tried to set the background color of button but no success. Please refer the attached images. First image is MAC window and second one is Window's window. Can anybody tell me what I am doing wrong in below code or how to set the default selected button? I have written the following code - from Tkinter import * def closeApp(): root.destroy() def replySUBJECTNAME(root): print 'Ok clicked' def SUBJECTNAME(root): w=root.winfo_screenwidth() h=root.winfo_screenheight() root.geometry('220x100+%d+%d' % ((w-220)/2, (h-100)/2)) root.title("SUBJECT NAME") btn=Button(root, name="okbutton", text="OK", command=(lambda: replySUBJECTNAME(root))) btn.configure(bg = "blue", fg = "red") btn.grid(row="0", column="0", sticky=NW) btn.bind('', lambda e:replySUBJECTNAME(root)) btn.focus_set() Button(root, text="Cancel", command=(lambda: closeApp())).grid(row="0", column="0", sticky=N) entry = Entry(root, width = "30", name="entry").grid(row="1", column="0") child = root.nametowidget("entry") child.insert(0, "Subject Name") root = Tk() SUBJECTNAME(root) root.mainloop() Please let me know what I am doing wrong in above code or if any other approach? Thanks in advance. Yogendra Mohan http://www.nabble.com/file/p22755049/MAC.png http://www.nabble.com/file/p22755049/window.jpg -- View this message in context: http://www.nabble.com/Facing-issue-to-show-the-default-button-Selected-on-MAC-OS----urgent-tp22755049p22755049.html Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. From kw at codebykevin.com Mon Mar 30 16:01:52 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 30 Mar 2009 10:01:52 -0400 Subject: [Tkinter-discuss] Facing issue to show the default button Selected on MAC OS - urgent In-Reply-To: <22755049.post@talk.nabble.com> References: <22755049.post@talk.nabble.com> Message-ID: <49D0D0D0.303@codebykevin.com> YMohan wrote: > Hi All, > > I am using MAC OS 10.5.1 and Python 2.5.1. I want to show the defalut > selected button in Tk window. I have two buttons OK and CANCEL. I want to > show the by default OK Button selected but I am not able to do the same on > MAC environment. The same code works in Windows. I have tried to set the > background color of button but no success. Please refer the attached images. > First image is MAC window and second one is Window's window. > > Can anybody tell me what I am doing wrong in below code or how to set the > default selected button? I have written the following code - > > On the Mac, Tk buttons ignore the -bg and -fg flags. The way to specify the default button would be something like this: btn.configure(bg = "blue", fg = "red", default=ACTIVE) That shows the Mac Tk button with focus/selected state. This should work on Windows, as well--there's no need to specify -fg and -bg colors to indicate default status. -- Kevin Walzer Code by Kevin http://www.codebykevin.com