[AG-TECH] "Status" window for what's going on?

Frank Sweetser fs at wpi.edu
Fri Feb 21 10:51:18 CST 2003


Here's a quick program I whipped up to make a little bulleting board.  It
pops up two windows. One goes up on a display, and the other one stays on the
console where you have two inputs, one which becomes the title and the other
the text of the one on display.  It's not much, but it should at least be a
little more elegant than notepad...

-- 
Frank Sweetser fs at wpi.edu
WPI Network Engineer
-------------- next part --------------
#!/usr/bin/python

from Tkinter import *
from tkFont import *

class BBrd:
    def __init__(self, master):

        self.deftitle = "Access Grid Bulletin Board"

        master.title("Bulletin Board Input")
        inframe = Frame(master)
        inframe.pack()

        self.font = Font(size="20", weight=BOLD)
        
        self.title = Text()
        self.title.config(height=1)
        self.title.insert(INSERT,self.deftitle)
        self.title.pack()

        self.input = Text()
        self.input.config(height=5)
        self.input.pack()

        self.disp = Toplevel(master)
        self.disp.title(self.deftitle)
        self.outframe = Frame()
        self.outframe.pack()

        self.curt = Text(self.disp)
        self.curt.config(state=DISABLED, height=5, bg="black", fg="white", font=self.font)
        self.curt.pack()

        b = Button(master, text="Display", command=self.push_text)
        b.pack()

    def push_text(self):
        self.curt.config(state=NORMAL)
        self.curt.delete(1.0,END)
        self.curt.insert(INSERT,self.input.get(1.0,END))
        self.curt.config(state=DISABLED)

        self.disp.title(self.title.get(1.0,END))
        

root = Tk()

app = BBrd(root)

root.mainloop()


More information about the ag-tech mailing list