Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75775

Re: Tkinter menu crash

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'configure': 0.05; 'subject:menu': 0.05; 'grid': 0.09; 'methods,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; 'least)': 0.16; 'parameter.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'shortcut': 0.16; 'subject:Tkinter': 0.16; 'widgets.': 0.16; 'wrote:': 0.18; 'widget': 0.19; '(the': 0.22; 'header:User-Agent:1': 0.23; 'commands,': 0.24; 'mention': 0.26; 'possibly': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:( 20': 0.30; '(which': 0.31; 'are.': 0.31; 'convenience': 0.31; 'cases': 0.33; 'but': 0.35; 'add': 0.35; 'similar': 0.36; 'expected': 0.38; 'sometimes': 0.38; 'generic': 0.38; 'initially': 0.38; 'same.': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'received:71': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'pack,': 0.84; 'received:fios.verizon.net': 0.84; 'items,': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Tkinter menu crash
Date Wed, 06 Aug 2014 00:13:56 -0400
References <1a31faea-eea6-4b1d-8dc1-185f13348621@googlegroups.com> <mailman.12677.1407275016.18130.python-list@python.org> <c2e3b6d8-da9a-447d-b67e-01877159412d@googlegroups.com> <mailman.12681.1407281280.18130.python-list@python.org> <98374ac7-7777-4963-a9a9-3fd70803ea74@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-71-175-90-87.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <98374ac7-7777-4963-a9a9-3fd70803ea74@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12685.1407298465.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407298465 news.xs4all.nl 2909 [2001:888:2000:d::a6]:34962
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75775

Show key headers only | View raw


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 widget (which keeps a 
reference to the parent. Now we want to put it into the parent. How?

The generic grid, pack, and place geometry methods are called on the 
child, with no mention of the parent. (The child reference to the parent 
is used instead.)  Do note, however, that child-independent geometry 
configure methods, like grid rowconfigure, are called on the parent.

Widget-specific geometry methods, however, are (mostly at least) called 
on the parent, with the child passed as a parameter.  Menus can contain 
both commands, which are not widgets, and submenus, which are. They are 
packed with add_command and add_cascade.  Canvases have add methods that 
place items, which again may or may not be widgets.

I initially found child.pack(args) confusing, because I expected the 
pattern to be (child.parent).pack(child, args).  But now that I think 
about it, the shortcut is similar to instance.method(args) sometimes 
meaning (instance.__class__).method(instance, args).  The convenience in 
both cases is about the same.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Tkinter menu crash Nicholas Cannon <nicholascannon1@gmail.com> - 2014-08-05 05:15 -0700
  Re: Tkinter menu crash Terry Reedy <tjreedy@udel.edu> - 2014-08-05 17:43 -0400
    Re: Tkinter menu crash Nicholas Cannon <nicholascannon1@gmail.com> - 2014-08-05 15:28 -0700
      Re: Tkinter menu crash Terry Reedy <tjreedy@udel.edu> - 2014-08-05 19:27 -0400
        Re: Tkinter menu crash Nicholas Cannon <nicholascannon1@gmail.com> - 2014-08-05 16:33 -0700
          Re: Tkinter menu crash Terry Reedy <tjreedy@udel.edu> - 2014-08-06 00:13 -0400

csiph-web