<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><BR><BR>--- On <B>Tue, 5/26/09, W W <I>&lt;srilyk@gmail.com&gt;</I></B> wrote:<BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: W W &lt;srilyk@gmail.com&gt;<BR>Subject: Re: [Tutor] Tinkering with Tkinter<BR>To: "Doug Reid" &lt;rnrcreid@yahoo.com&gt;<BR>Cc: Tutor@python.org<BR>Date: Tuesday, May 26, 2009, 11:42 AM<BR><BR>
<DIV class=gmail_quote>On Mon, May 25, 2009 at 7:45 PM, Doug Reid <SPAN dir=ltr>&lt;<A href="http://us.mc457.mail.yahoo.com/mc/compose?to=rnrcreid@yahoo.com" target=_blank rel=nofollow ymailto="mailto:rnrcreid@yahoo.com">rnrcreid@yahoo.com</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD style="FONT-FAMILY: inherit; font-size-adjust: inherit; font-stretch: inherit" vAlign=top>
<DIV>The following code and it's explanation doesn't seem to work:</DIV>
<DIV>&nbsp;</DIV><FONT face=CMTT8 color=#00ff00 size=1><FONT face=CMTT8 color=#00ff00 size=1><FONT face=CMTT8 color=#00ff00 size=1>
<P align=left><FONT color=#000000>1. &gt;&gt;&gt; from Tkinter import *</FONT> </DIV>
<P align=left><FONT color=#000000>2. &gt;&gt;&gt; tk = Tk()</FONT> </DIV>
<P align=left><FONT color=#000000>3. &gt;&gt;&gt; btn = Button(tk, text="click me")</FONT> </DIV>
<P align=left><FONT color=#000000>4. &gt;&gt;&gt; btn.pack()</FONT> </DIV>
<P align=left><FONT color=#000000></FONT>&nbsp;</DIV></FONT></FONT></FONT><FONT face=CMR12>
<P align=left>In line 1, we import the contents of the </DIV></FONT><FONT face=CMR12 color=#00ff00><FONT face=CMR12 color=#00ff00>Tk </FONT></FONT><FONT face=CMR12>module, so we can use them—the 
<P align=left>most useful of these is </DIV></FONT><FONT face=CMR12 color=#00ff00><FONT face=CMR12 color=#00ff00>Tk</FONT></FONT><FONT face=CMR12>, which creates a basic window to which we can then add 
<P align=left></DIV></FONT><FONT face=CMR12>things. After you type in line 2, that window will suddenly appear on the screen. 
<P align=left>In line 3, we create a new Button and assign it to the variable </DIV></FONT><FONT face=CMR12 color=#00ff00><FONT face=CMR12 color=#00ff00>btn</FONT></FONT><FONT face=CMR12>. The button 
<P align=left>is created by passing the </DIV></FONT><FONT face=CMR12 color=#00ff00><FONT face=CMR12 color=#00ff00>tk </FONT></FONT><FONT face=CMR12>object as a parameter, along with a named parameter 
<DIV>with the words ‘click me’.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Nothing appears on the screen after I enter line 2...I can type in the code in the editor and double click after saving the file and it does, but not from the shell, how can that be fixed or am I doing something wrong?</DIV></FONT></TD></TR></TBODY></TABLE></BLOCKQUOTE></DIV>
<DIV><BR>Works for me! <BR><BR>What is your os/python verision? Are you working from Idle? AFAIK, IDLE is written in Tk and so it does not so much like Tkinter programs in it's interactive shell. If you're on windows, try typing "cmd" in the run dialog and then type "python" at the prompt, then try the example.<BR><BR>HTH,<BR>Wayne</DIV>
<DIV>&nbsp;</DIV>
<DIV>+++Thanks for the help.&nbsp; I tried it from the command line and it worked fine.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Doug<BR></DIV></BLOCKQUOTE></td></tr></table><br>