<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C1D4E3.5C9F8F30">
<title>TKinter question - A combo box / menu question</title>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:UseFELayout/>
  </w:Compatibility>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Batang;
        panose-1:2 3 6 0 0 1 1 1 1 1;
        mso-font-alt:\00A1\00CB\00A2\00E7\00A2\00AE\00A1\00BFIoUAA;
        mso-font-charset:129;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1342176593 1775729915 48 0 524447 0;}
@font-face
        {font-family:"\@Batang";
        panose-1:2 3 6 0 0 1 1 1 1 1;
        mso-font-charset:129;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1342176593 1775729915 48 0 524447 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:Batang;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:Batang;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:navy;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><!-- Converted from text/rtf format -->First,
let me apologize for sending this in HTML the first time. <span
style='mso-spacerun:yes'> </span>I have had a few responses on this, but
nothing turns up.<span style='mso-spacerun:yes'>   </span>Basically,
I want to pop-up a <span class=SpellE>ComboDialogBox</span> as a result of a
Menu selection.<span style='mso-spacerun:yes'>  </span>What I am doing is
creating the <span class=SpellE>ComboDialogBox</span> <span class=SpellE>everytime</span>
it gets to the “command” portion of the Menu option. <span
style='mso-spacerun:yes'> </span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Here is most of the relevant code:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><span class=GramE><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>class</span></font></span><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'> <span class=SpellE>mainWindow</span>:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span>#Build the components into the main window<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> __init__(self, master):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span># Begin creation of the main
menu items here.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE># File
section.</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>mbar</span>
= Menu(master, <span class=SpellE>tearoff</span>=0)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>master[</span>'menu']
= mbar<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE><span
class=GramE>frameForDialog</span></span> = frame(master, N)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>file_menu</span>
= <span class=GramE>Menu(</span>mbar, <span class=SpellE>tearoff</span>=0)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>file_menu.add_<span
class=GramE>command</span></span><span class=GramE>(</span>label='Load Form',
command=<span class=SpellE>self.open_file</span>(<span class=SpellE>frameForDialog</span>))<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>file_menu.add_<span
class=GramE>command</span></span><span class=GramE>(</span>label='Save Form',
command=<span class=SpellE>self.save_file</span>)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>file_menu.add_<span
class=GramE>command</span></span><span class=GramE>(</span>label='New Form',
command=<span class=SpellE>self.new_file</span>)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>file_menu.add_<span
class=GramE>separator</span></span><span class=GramE>()</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>file_menu.add_<span
class=GramE>command</span></span><span class=GramE>(</span>label='Quit',
command=<span class=SpellE>self.quit_file</span>)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE>mbar.add_<span
class=GramE>cascade</span></span><span class=GramE>(</span>label='File',
underline=0, menu=<span class=SpellE>file_menu</span>)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span># End top pull down menu
selections.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE><span
class=GramE>statEditorFrame</span></span> = frame(master, N)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=SpellE><span
class=GramE>statEditor</span></span> = <span class=SpellE>StatEditor</span>(<span
class=SpellE>statEditorFrame</span>)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> <span class=SpellE>open_file</span>(self,
parent):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span>#Need the <span
class=SpellE>listofcharacters</span> to be a <span class=SpellE>tuple</span>
sequence.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=GramE>from</span> <span class=SpellE>char_edit_combo_load</span> import *<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=GramE>forms</span> = []<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=SpellE><span class=GramE>listOfCharacters</span></span> = <span
class=SpellE>tuple</span>(<span class=SpellE>getFiles</span>(forms))<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=GramE>dialog</span> = <span class=SpellE>Pmw.ComboBoxDialog</span>(parent,
title = "Character Load",<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>                                 
</span><span class=GramE>buttons</span> = ('OK', 'Cancel'), <span class=SpellE>defaultbutton</span>
= 'OK',<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>                                 
</span><span class=SpellE>combobox_labelpos</span>=N, <span class=SpellE>label_text</span>="Please
select a character",<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>        
</span><span
style='mso-spacerun:yes'>                         </span><span
class=SpellE>scrolledlist_items</span>=<span class=SpellE>listOfCharacters</span>,
<span class=SpellE>listbox_width</span>=22)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=SpellE><span class=GramE>dialog.withdraw</span></span><span class=GramE>()</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=GramE>result=</span><span class=SpellE>dialog.activate</span>()<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span># <span
class=GramE>The</span> function has now opened seen the selection, time to open
the file.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=GramE>if</span> result == 'OK':<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>        </span><span
class=GramE>return(</span><span class=SpellE>readObjectFromFile</span>(<span
class=SpellE>dialog.get</span>()))<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>      </span><span
class=GramE>else</span>:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>        </span><span
class=GramE>return(</span>None)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> <span class=SpellE>save_file</span>(self):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span>#<span class=GramE>This</span>
will save the file off<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>print(</span>'SF:
Stub')<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> <span class=SpellE>quit_file</span>(self):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span>#<span class=GramE>This</span>
will save the file off<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>print(</span>'SF:
Stub')<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> <span class=SpellE>new_file</span>(self):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span>#<span class=GramE>This</span>
will save the file off<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>print(</span>'NF:
Stub')<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> <span class=SpellE>add_level</span>(self):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span>#<span class=GramE>This</span>
will save the file off<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>print(</span>'SF:
Stub')<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span style='mso-spacerun:yes'> 
</span><span class=GramE>def</span> <span class=SpellE>subtract_level</span>(self):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span>#<span class=GramE>This</span>
will save the file off<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>    </span><span class=GramE>print(</span>'NF:
Stub')<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><span class=GramE><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>root=</span></font></span><span
class=SpellE><font size=2 color=navy face=Arial><span style='font-size:10.0pt;
font-family:Arial;color:navy'>Tk</span></font></span><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>()<o:p></o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><span class=GramE><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>root.title</span></font></span></span><span class=GramE><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>(</span></font></span><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>'Character Generator')<o:p></o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><span class=GramE><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>Pmw.initialise</span></font></span></span><span class=GramE><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>()</span></font></span><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p></o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><span class=GramE><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>topWindow</span></font></span></span><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> = <span
class=SpellE>mainWindow</span>(root)<o:p></o:p></span></font></p>

<p class=MsoNormal><span class=SpellE><span class=GramE><font size=2
color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>root.mainloop</span></font></span></span><span class=GramE><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>()</span></font></span><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p></o:p></span></font></p>

</div>

</body>

</html>