By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

Tkinter interactive

P: n/a
Hello i am fairly new to python,
I have written an interactive programme a small example of it is here.
s = raw_input ("Do you have any children? ")
if s== 'yes':
print "Thats great"
elif s=='no':
print "Well my boss has 2"
Now i have also been looking at Tkinter if we take the basic "hello, world"
programme which is like this.

# File: hello1.py

from Tkinter import *

root = Tk()

w = Label(root, text="Hello,!")
w.pack()

root.mainloop()

What i want is to incorporate this in to my programme so when i start my
programme a little box appears saying hello then my interactive programme
runs within the box
This it what it looks like

from Tkinter import *

root = Tk()

w = Label(root, text="Hello,!")
w.pack()
s = raw_input ("Do you have any children? ")
if s== 'yes':
print "Thats great"
elif s=='no':
print "Well my boss has 2"

The result of that is i just get another box open and start to run my
interactive programme as though it ignores the Tk box which says hello hope
this makes sense any advise on this please.
thanks nige
Dec 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
cm012b5105 wrote:
Hello i am fairly new to python,
I have written an interactive programme a small example of it is here.
s = raw_input ("Do you have any children? ")
if s== 'yes':
print "Thats great"
elif s=='no':
print "Well my boss has 2"
Now i have also been looking at Tkinter if we take the basic "hello, world"
programme which is like this.

# File: hello1.py

from Tkinter import *

root = Tk()

w = Label(root, text="Hello,!")
w.pack()

root.mainloop()

What i want is to incorporate this in to my programme so when i start my
programme a little box appears saying hello then my interactive programme
runs within the box
This it what it looks like

from Tkinter import *

root = Tk()

w = Label(root, text="Hello,!")
w.pack()
s = raw_input ("Do you have any children? ")
if s== 'yes':
print "Thats great"
elif s=='no':
print "Well my boss has 2"

The result of that is i just get another box open and start to run my
interactive programme as though it ignores the Tk box which says hello hope
this makes sense any advise on this please.
thanks nige


GUI programming is kind of advanced. It is tough to make a leap from the
hello world program of a new language to an interactive gui interface. I
think you can save yourself a lot of frustration and confusion by first
working throught the python tutorial:

http://docs.python.org/tut/tut.html

Then working throught the "Tkinter tutorial":

http://www.python.org/doc/life-preserver/

Pound these out over the course of a few weekends and you will be leaps
and bounds further in your understanding than if you attempted to learn
through unguided exploration (though the latter may be more fun sometimes).

James
Dec 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.