Nub needs help withTkinter

Agency image9n at
Tue Dec 9 20:29:04 CET 2003


So, I'm stuck again. I tried putting the code into a class, might not
smart given what I know, but I did it. I'm thinking that the beat,
time, and bpm would each have their own class and display/label. I
know that the pack() determines if something shows up. So, I'm
guessing that somewhere along the line pack() is not be referenced
right. My problem is that I have a window,
with no label showing up. I also just noticed that there is no linkage
between the beatContainer/frame and the beatNum/label.  Here is the
newbie code:

from Tkinter import *

class beatX:
    def _init_(self, parent):
        self.beatContainer = Frame(parent)

        self.beatNum = Label(self, text = "Beat Counter : ")
        self.beatNum.config(text = "Beat Counter : %d" %beats)
        self.beatNum.bind("<space>", self.beatCounter)
        self.beatNum.bind("<Return>", self.beatReset)
    def beatCounter(event):
        print "increment counter"
        beats = beats + 1       
    def beatReset(event):
        print "reset counter"
        beats = 0
root = Tk()

More information about the Python-list mailing list