473,554 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.qu it)
self.button.pac k(side=LEFT)

self.hi_there = Button(frame, text="Hello", command=self.sa y_hi)
self.hi_there.p ack(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 1913
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.qu it) self.button.pac k(side=LEFT)

self.hi_there = Button(frame, text="Hello", command=self.sa y_hi)
self.hi_there.p ack(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.q uit)
self.button.pac k(side=LEFT)

self.hi_there = Button(frame, text="Hello",
command=self.sa y_hi)
self.hi_there.p ack(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.q uit)
self.button.pac k(side=LEFT)
self.hi_there = Button(frame, text="Hello", command=self.sa y_hi)
self.hi_there.p ack(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
5438
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 restore the saves later. I'm using the pickle module to implement this. Capturing current program state and neatly replacing it later is proving to be trickier than I first imagined, so I'm here to...
0
955
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 Collection Editor dialog box appears, it does not show like that in the tutorial, it does not show any BoundField at all.
1
1447
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 like a long post, but I hope that a complete explanation help you to help me :=) ....Let's start with some background: ..- I'm building an asp.net application that requires users to upload text...
4
1598
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 syntax. This is what I want: page usercontrol 1 - set variable usercontrol 2 - read variable
6
1481
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 putting it in code im totaly stuck. i know nothing about it. can somebody pls tell me where i can find a gud tutorial to solve my problem ? plsssss........... help !!! thank you Vinci
0
5537
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
2
5400
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, Safari, Camino & even IE5 for mac!!! But not IE7! The 'floating layer' does not float in IE7... it just sits up at the top of the screen - stuck in one place!! Explorer - why do you mock us?!!! ;( ...
2
4061
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 send the email to myself. The form works OK, but when it deliver's it to my inbox, I am getting all of this jibberish with the email Example: Name: <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT...
1
1357
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 deviation. i will be greatful for your help.
0
7605
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7893
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6156
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5441
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3556
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2022
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.