Tkinter interactive

C

cm012b5105

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
 
J

James Stroud

cm012b5105 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,592
Members
45,103
Latest member
VinaykumarnNevatia
Top