PyTk cascaded radiobuttons, howto?

nickgeovanis at gmail.com nickgeovanis at gmail.com
Wed Dec 9 19:17:05 EST 2015


Using python 3.4.2.
Tcl/tk example here is from /usr/share/tk8.5/demos/widget and .../menu.tcl.
The way tcl/tk adds cascaded radiobuttons to a menu is like this:
set m $w.menu.cascade
$w.menu add cascade -label "Cascades" -menu $m -underline 0
....
$m add cascade -label "Radio buttons" -menu $w.menu.cascade.radio...
set m $w.menu.cascade.radio
$m add radio -label "Roman" -variable style...
$m add radio -label "Italic" -variable style...

...and so on.

My difficulty doing the same in PyTk is the following: When creating that uppermost cascade, you do something like
menu.add_cascade(label = "Cascades")
...but there is no ability to save a usable reference to that top-level cascade. If I do so anyway and add a radiobutton to it, nothing appears, no errors either. What is the correct way to cascade radiobuttons from a cascaded menu in PyTk? Thanks....Nick




More information about the Python-list mailing list