--- On Tue, 5/26/09, W W <sri...@gmail.com> wrote:


From: W W <sri...@gmail.com>
Subject: Re: [Tutor] Tinkering with Tkinter
To: "Doug Reid" <rnrcr...@yahoo.com>
Cc: Tutor@python.org
Date: Tuesday, May 26, 2009, 11:42 AM


On Mon, May 25, 2009 at 7:45 PM, Doug Reid <rnrcr...@yahoo.com> wrote:






The following code and it's explanation doesn't seem to work:
 
1. >>> from Tkinter import * 
2. >>> tk = Tk() 
3. >>> btn = Button(tk, text="click me") 
4. >>> btn.pack() 
 
In line 1, we import the contents of the Tk module, so we can use them—the 
most useful of these is Tk, which creates a basic window to which we can then 
add 
things. After you type in line 2, that window will suddenly appear on the 
screen. 
In line 3, we create a new Button and assign it to the variable btn. The button 
is created by passing the tk object as a parameter, along with a named 
parameter 
with the words ‘click me’.
 
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?

Works for me! 

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.

HTH,
Wayne
 
+++Thanks for the help.  I tried it from the command line and it worked fine.
 
Doug



      
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to