Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-07 Thread Rich Shepard
On Wed, 6 Jan 2021, Terry Reedy wrote: 'underline' has nothing to do with looking up the command in self.callbacks. It is a keyword parameter for the add_command method, and is handled like all other values passed by name, and as you did for the other arguments file_menu.add_command(

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-07 Thread Terry Reedy
On 1/6/2021 4:17 PM, Terry Reedy wrote: On 1/6/2021 4:03 PM, Rich Shepard wrote: On Thu, 7 Jan 2021, Chris Angelico wrote: Are you sure that this works? It's syntactically valid, but I don't think it means what you think it does. ChrisA, I'm always open to learning. There's no error generat

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-07 Thread Rich Shepard
On Thu, 7 Jan 2021, Peter Otten wrote: Spoiler: unless the name 'underline' is defined you get a NameError: NameError: name 'underline' is not defined If it is defined and self.callbacks is a dict you get a TypeError: TypeError: unhashable type: 'slice' because that's what a colon means in a con

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-07 Thread Peter Otten
On 06/01/2021 22:03, Grant Edwards wrote: I'm completely baffled by that. Can somebody explain how this expression is evaluated? self.callbacks['file->new', underline: 0] It appears that the dict callbacks is being accessed with the key of a tuple comprising a string and a slice. Huh? Y

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-07 Thread Peter Otten
On 06/01/2021 22:03, Rich Shepard wrote: On Thu, 7 Jan 2021, Chris Angelico wrote: Are you sure that this works? It's syntactically valid, but I don't think it means what you think it does. ChrisA, I'm always open to learning. There's no error generated ... yet the application doesn' open so

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Chris Angelico
On Thu, Jan 7, 2021 at 9:22 AM Grant Edwards wrote: > > On 2021-01-06, Rich Shepard wrote: > > On Wed, 6 Jan 2021, 2qdxy4rzwzuui...@potatochowder.com wrote: > > > >> For the sake of future generations who may run into this issue, can you > >> post the complete, correct call to file_menu.add_comma

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Terry Reedy
On 1/6/2021 4:03 PM, Rich Shepard wrote: On Thu, 7 Jan 2021, Chris Angelico wrote: Are you sure that this works? It's syntactically valid, but I don't think it means what you think it does. ChrisA, I'm always open to learning. There's no error generated ... yet the application doesn' open so

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Grant Edwards
On 2021-01-06, Rich Shepard wrote: > On Wed, 6 Jan 2021, 2qdxy4rzwzuui...@potatochowder.com wrote: > >> For the sake of future generations who may run into this issue, can you >> post the complete, correct call to file_menu.add_command? > > This is the working version of the stanza I initially pos

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Rich Shepard
On Thu, 7 Jan 2021, Chris Angelico wrote: Cool. Terry had something on the subject in the other thread; I think that's a good place to start. (I don't know much about Tkinter, this line of code just looked odd in general Python syntax.) ChrisA, It's been a long time since I wrote any Python c

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Chris Angelico
On Thu, Jan 7, 2021 at 8:04 AM Rich Shepard wrote: > > On Thu, 7 Jan 2021, Chris Angelico wrote: > > > Are you sure that this works? It's syntactically valid, but I don't > > think it means what you think it does. > > ChrisA, > > I'm always open to learning. There's no error generated ... yet the

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Rich Shepard
On Thu, 7 Jan 2021, Chris Angelico wrote: Are you sure that this works? It's syntactically valid, but I don't think it means what you think it does. ChrisA, I'm always open to learning. There's no error generated ... yet the application doesn' open so it's time to run it through pdb. Regards

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Chris Angelico
On Thu, Jan 7, 2021 at 7:43 AM Rich Shepard wrote: > This is the working version of the stanza I initially posted: > > file_menu.add_command( > label = 'New', > command = self.callbacks['file->new', underline: 0], > accelerator = 'Ctrl+N' > )

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Rich Shepard
On Wed, 6 Jan 2021, 2qdxy4rzwzuui...@potatochowder.com wrote: For the sake of future generations who may run into this issue, can you post the complete, correct call to file_menu.add_command? This is the working version of the stanza I initially posted: file_menu.add_command(

Re: Tkinter menu item underline syntax

2021-01-06 Thread Terry Reedy
On 1/6/2021 1:32 PM, Rich Shepard wrote: My application's menu has lines like this:     file_menu.add_command(     label = 'New',     command = self.callbacks['file->new', underline 0],     accelerator = 'Ctrl+N'     ) 'underline' has nothing to do with look

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread 2QdxY4RzWzUUiLuE
On 2021-01-06 at 11:18:15 -0800, Rich Shepard wrote: > On Wed, 6 Jan 2021, 2qdxy4rzwzuui...@potatochowder.com wrote: > > > I'm not a TKinter expert (nor even a current user), but that line that > > begins with whitespace and "command =" looks suspicious. As far as I can > > see, Python is correc

Re: Tkinter menu item underline syntax [RESOLVED]

2021-01-06 Thread Rich Shepard
On Wed, 6 Jan 2021, 2qdxy4rzwzuui...@potatochowder.com wrote: I'm not a TKinter expert (nor even a current user), but that line that begins with whitespace and "command =" looks suspicious. As far as I can see, Python is correct to call it syntactically erroneous. Yes, the line above it needed

Re: Tkinter menu item underline syntax

2021-01-06 Thread 2QdxY4RzWzUUiLuE
On 2021-01-06 at 10:32:58 -0800, Rich Shepard wrote: > My application's menu has lines like this: > file_menu.add_command( > label = 'New', > command = self.callbacks['file->new', underline 0], > accelerator = 'Ctrl+N' > ) > > Python reports a

Re: Tkinter menu crash

2014-08-05 Thread Terry Reedy
On 8/5/2014 7:33 PM, Nicholas Cannon wrote: I am confused. When I did menu bar.add_cascade why don't I do filemenu.add_cascade. Is it because I am adding a cascade to the main menubar? Let us start with a widget, that can 'contain' other widgets (and possibly other things). We create a child

Re: Tkinter menu crash

2014-08-05 Thread Nicholas Cannon
I am confused. When I did menu bar.add_cascade why don't I do filemenu.add_cascade. Is it because I am adding a cascade to the main menubar? -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter menu crash

2014-08-05 Thread Terry Reedy
On 8/5/2014 6:28 PM, Nicholas Cannon wrote: Ok so I am on 2.7.8. What x.y.z version of Python. How did you run it, exactly? Adding filemenu as a submenu of filemenu leads to infinite loop regress. On 3.4.1 with tcl/tk 8.6, this does not crash, but it might on an earlier version of Python an

Re: Tkinter menu crash

2014-08-05 Thread Nicholas Cannon
Ok so I am on 2.7.8. > What x.y.z version of Python. How did you run it, exactly? > Adding filemenu as a submenu of filemenu leads to infinite loop regress. > > On 3.4.1 with tcl/tk 8.6, this does not crash, but it might on an > > earlier version of Python and tcl/tk. > Since menubar is left e

Re: Tkinter menu crash

2014-08-05 Thread Terry Reedy
On 8/5/2014 8:15 AM, Nicholas Cannon wrote: Ok so the first part of the program(until the start of the menu) worked fine. It ran and did what I wanted it to do. What x.y.z version of Python. How did you run it, exactly? I wanted to then implement a new menu(for practise) and then it crashes

Re: Tkinter menu checkbutton not working

2010-06-12 Thread Dodo
Le 09/06/2010 20:37, rantingrick a écrit : On Jun 9, 12:20 pm, Dodo wrote: Le 09/06/2010 18:54, rantingrick a crit : On Jun 9, 11:26 am, Dodowrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window:

Re: Tkinter menu checkbutton not working

2010-06-09 Thread rantingrick
On Jun 9, 12:20 pm, Dodo wrote: > Le 09/06/2010 18:54, rantingrick a crit : > > > > > > > On Jun 9, 11:26 am, Dodo  wrote: > >> Hello, > > >> I trying to make this piece of code work (this is python3) > > >> from tkinter import * > >> from tkinter.ttk import * > > >> class Window: > >>    def __in

Re: Tkinter menu checkbutton not working

2010-06-09 Thread Dodo
Le 09/06/2010 18:54, rantingrick a écrit : On Jun 9, 11:26 am, Dodo wrote: Hello, I trying to make this piece of code work (this is python3) from tkinter import * from tkinter.ttk import * class Window: def __init__(self): self.root = Tk() self.menu = Menu(self.root) self.roo

Re: Tkinter menu checkbutton not working

2010-06-09 Thread rantingrick
On Jun 9, 11:26 am, Dodo wrote: Also you are now NOT using 8 space indention unlike your last post -- which i applaud you for. However you've gone to the opposite extreme with 2 space indention and interlaced it with one space indention, oh dear! Please use four space indention as this is the p

Re: Tkinter menu checkbutton not working

2010-06-09 Thread rantingrick
On Jun 9, 11:26 am, Dodo wrote: > Hello, > > I trying to make this piece of code work (this is python3) > > from tkinter import * > from tkinter.ttk import * > > class Window: >   def __init__(self): >    self.root = Tk() > >    self.menu = Menu(self.root) >    self.root['menu'] = self.menu > >  

Re: Tkinter Menu Item Activation

2008-02-26 Thread Eric Brunel
On Fri, 22 Feb 2008 13:30:06 +0100, <[EMAIL PROTECTED]> wrote: [snip] > Sub problems: how to change state of menu item? how to detect changes > in Text widget? If you have a reasonably recent tcl/tk version (>= 8.4), you should have a edit_modified() method on your Text telling you if it has bee

Re: Tkinter Menu Item Activation

2008-02-22 Thread MartinRinehart
Rob Wolfe wrote: > But I think that you should read this: > http://effbot.org/zone/vroom.htm Rob, may the gods shower you with gold coins! -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Menu Item Activation

2008-02-22 Thread Rob Wolfe
[EMAIL PROTECTED] writes: > Tkinter definitely deserves more respect! I'm making rapid progress > and it looks good. > > But am stuck on this: I want the File/Save state to change from > disabled to enabled, depending on whether or not there is something to > save (Text modified). Google returns r

Re: Tkinter menu question--how to pass arguments

2007-03-30 Thread Kevin Walzer
Dave Opstad wrote: > In article <[EMAIL PROTECTED]>, > Kevin Walzer <[EMAIL PROTECTED]> wrote: > >> I'm having difficulty structuring a Tkinter menu entry. Here is the >> command in question: >> >> self.finkmenu.add_command(label='Update List of Packages', >> command=self.authorizeCommand(self.

Re: Tkinter menu question--how to pass arguments

2007-03-30 Thread Kevin Walzer
[EMAIL PROTECTED] wrote: > On Mar 30, 2:32 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote: >> I'm having difficulty structuring a Tkinter menu entry. Here is the >> command in question: >> >> self.finkmenu.add_command(label='Update List of Packages', >> command=self.authorizeCommand(self.scanPackages))

Re: Tkinter menu question--how to pass arguments

2007-03-30 Thread kyosohma
On Mar 30, 2:32 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote: > I'm having difficulty structuring a Tkinter menu entry. Here is the > command in question: > > self.finkmenu.add_command(label='Update List of Packages', > command=self.authorizeCommand(self.scanPackages)) > > When I start my program, it

Re: Tkinter menu question--how to pass arguments

2007-03-30 Thread kyosohma
On Mar 30, 2:32 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote: > I'm having difficulty structuring a Tkinter menu entry. Here is the > command in question: > > self.finkmenu.add_command(label='Update List of Packages', > command=self.authorizeCommand(self.scanPackages)) > > When I start my program, it

Re: Tkinter menu question--how to pass arguments

2007-03-30 Thread Dave Opstad
In article <[EMAIL PROTECTED]>, Kevin Walzer <[EMAIL PROTECTED]> wrote: > I'm having difficulty structuring a Tkinter menu entry. Here is the > command in question: > > self.finkmenu.add_command(label='Update List of Packages', > command=self.authorizeCommand(self.scanPackages)) > > When I st

Re: Tkinter menu toplevel or frame

2007-03-15 Thread Matimus
> Please tell me is here anything that I should change. The way you have written it, master _must_ be a Toplevel object. So, maybe parent is the correct name, but it doesn't really matter. As a side note, there is no reason for this class to inherit Frame. Aside from packing and sizing the frame,

Re: Tkinter menu

2005-12-02 Thread [EMAIL PROTECTED]
> > the easiest way to do this is to create a new function object for each > file, and use default argument binding to pass in the right filename: > > for file in self.allfiles: > def callback(fname=file): > self.showFile(fname, parent) > self.showfilemenu_bar.add

Re: Tkinter menu

2005-12-01 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > I'm writing a small GUI program in Python/Tkinter (my first Python > program). I want to make a menu which lists the names of a number of > text files that my program uses/generates. When I select one of the > files from the menu, I would like a new window to open up

Re: Tkinter, Menu(bar) font size

2005-08-02 Thread Bob Greschke
Yeah. It works on a Sun and Linux, but not Windows. That stinks. We got a bunch of 1400x1050 display laptops in and now I have to run around changing a bunch of programs that looked fine on 1024x768 displays. Thanks! <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Tk tries to u

Re: Tkinter, Menu(bar) font size

2005-08-01 Thread jepler
Tk tries to use the "native" menu control on Windows (and, I think, MacOS). One result seems to be that for the application's menu bar you can't change the font. Of course, Windows provides a way for users to select a uniform font for menu bars in all applications, in the Display control panel. J

Re: tkinter menu bar problem

2005-02-10 Thread John Pote
Thanks for the reply. I now have radio buttons (with a nice tick!) on my menu that can be greyed out when disabled. I can also change the background colour of the individual buttons as you suggest. What I cannot do is change the background colour of the menu bar itself. The following code is ac

Re: tkinter menu bar problem

2005-02-09 Thread Eric Brunel
On Wed, 09 Feb 2005 11:35:40 GMT, John Pote <[EMAIL PROTECTED]> wrote: I have a menu bar in a top level window as follows [snip code] Q1 Cannot find a way of changing the menu bars background colour. When colour options are accepted they seem to be ignored. Is this a native look and feel chara

Re: tkinter menu bar problem

2005-02-09 Thread Eric Brunel
On Wed, 09 Feb 2005 11:35:40 GMT, John Pote <[EMAIL PROTECTED]> wrote: I have a menu bar in a top level window as follows [snip code] Q1 Cannot find a way of changing the menu bars background colour. When colour options are accepted they seem to be ignored. Is this a native look and feel chara