[Tutor] Tkinter Q's

Joseph Quigley cpu.crazy at gmail.com
Mon Jul 11 19:22:57 CEST 2005


Hi first off, here's my code:

# -*- coding: utf-8 -*-
from Tkinter import *
import random
import time
import about
import quotes


def closeprog():
    raise SystemExit

class main:
    root = Tk()
    frame = Frame()
    root.title("Quoter %s" % (about.ver))
    root.minsize(300, 50)

    showquote = Label(root, text=random.choice(quotes.quote))
    showquote.pack()

    exit = Button(root, text="Exit", command=closeprog)
    exit.pack(side=LEFT)

    aboutprg = Button(root, text="About", command=about.main)
    aboutprg.pack(side=LEFT)


    totalq = Label(root, text=quotes.qts)
    totalq.pack(side=BOTTOM)
   
    root.mainloop()

(I'd appreciate some suggestions, or notifications on how bad something is)

I have a small problem: I don't know how to make a button that would 
redisplay another quote in the same window, ie I need a button that 
says: Show Another Quote. (Actually I don't know how to make it show 
another quote even in a new window!!). I got the interface from Catfood 
Fortune Cookie.

Here's a tid-bit of the quotes module:
 # Brian Kernighan
bk1 = """Controlling complexity is the essence of computer programming.

-- Brian Kernighan"""

yadayada = """Foo/bar"""

quote = [bk1, yadayada]

Thanks,
    Joe

-- 
Unix Love, Linux Pride

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050711/f224c87f/attachment.htm


More information about the Tutor mailing list