472,353 Members | 2,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Help Pliz ! stuck on page 4 of tutorial

Hello everyone, I am a newbie starting Fredrik Lundh .pdf tutorial. Running W2000.

I am stuck in page four "Hello Again" program:
When I try running it, it shows the root Python window very fast and
dissapears. The intended Tk window with buttons: either does not
show, or dissapears fast before I can tell it is there. The first
program on the tutorial did run fine.

Here's the program as shown on the tutorial:

================================================== ==
from Tkinter import *

class App:

def_init-(self, master):

frame = Frame(master)
frame.pack()

self.button = Button(frame, text="QUIT", fg="red", comand=frame.quit)
self.button.pack(side=LEFT)

self.hi_there = Button(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):
print "Hi there, everyone !"
root = Tk()

app = App(root)

root.mainloop()
================================================== =

Any help will be much appreciated,

Adofo Aguirre
Santa Barbara, CA
Jul 18 '05 #1
3 1836
Adolfo wrote:
Hello everyone, I am a newbie starting Fredrik Lundh .pdf tutorial.
Running W2000.

I am stuck in page four "Hello Again" program:
When I try running it, it shows the root Python window very fast and
dissapears. The intended Tk window with buttons: either does not
show, or dissapears fast before I can tell it is there. The first
program on the tutorial did run fine.

Here's the program as shown on the tutorial:

================================================== ==
from Tkinter import *

class App:

def_init-(self, master):

frame = Frame(master)
frame.pack()

self.button = Button(frame, text="QUIT", fg="red",
comand=frame.quit) self.button.pack(side=LEFT)

self.hi_there = Button(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):
print "Hi there, everyone !"
root = Tk()

app = App(root)

root.mainloop()
================================================== =

Any help will be much appreciated,

Adofo Aguirre
Santa Barbara, CA


If you have cut and pasted here exactly what you fed to the Python,
proofreading should help. (Hint: def_init- and comand)

Peter
Jul 18 '05 #2
On Fri, 21 Nov 2003 16:10:11 -0800, Adolfo wrote:
Hello everyone, I am a newbie starting Fredrik Lundh .pdf tutorial. Running W2000.

I am stuck in page four "Hello Again" program:
When I try running it, it shows the root Python window very fast and
dissapears. The intended Tk window with buttons: either does not
show, or dissapears fast before I can tell it is there. The first
program on the tutorial did run fine.

Here's the program as shown on the tutorial:


You had a lot of typos in your code;
here's a corrected version which should work.

HTH, Thomas.
from Tkinter import *

class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()

self.button = Button(frame, text="QUIT",
fg="red", command=frame.quit)
self.button.pack(side=LEFT)

self.hi_there = Button(frame, text="Hello",
command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):
print "Hi there, everyone !"
root = Tk()
app = App(root)
root.mainloop()

--
mailto: logan@phreaker(NoSpam).net

Jul 18 '05 #3
Try this:

from Tkinter import *

class App:
def __init__(self, master): <========= name of constructor
frame = Frame(master)
frame.pack()
self.button = Button(frame, text="QUIT", fg="red",
command=frame.quit)
self.button.pack(side=LEFT)
self.hi_there = Button(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)
def say_hi(self):
print "Hi there, everyone !"

root = Tk()
app = App(root)
root.mainloop()
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jacob H | last post by:
Hello list... I'm developing an adventure game in Python (which of course is lots of fun). One of the features is the ability to save games and...
0
by: ccd | last post by:
as of now, i am stuck at this step 6 of the following section http://www.asp.net/webmatrix/tour/section3/formatdatagrid.a spx When the...
1
by: Esteban Felipe | last post by:
Hi, thanks for reading. I hope to find some help here before I commit suicide because this is driving me crazy. Please excuse me if this looks...
4
by: Darrel | last post by:
I'm really stuck on the concept of using public variables to pass information between usercontrols. I'm pretty sure I'm just flubbing up the...
6
by: vinci426 | last post by:
im stuck in creating a stock control system and i dont know head or tail when it comes to coding in. im gud in writing out logic but when it comes to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM...
2
by: Head In A Pan | last post by:
Hello! My JavaScripting is at novice level - and after completing a tutorial on a 'floating layer' I was proud that I got it working on Firefox,...
2
by: staryeyes47 | last post by:
Hi, I am creating a contact page for a my website and I am having a bit of trouble. I have created the form in flash, and am using a php file to...
1
by: programs | last post by:
thanks for all you are doing. pliz,i want your help on how to design a program that determines 20 prime numbers and computes their standard...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.