Why doesn't the text appear?
Wayne
infotechsys at pivot.net
Tue Feb 29 15:26:29 EST 2000
Hello,
I have two module . In the first I have this code-
# test call method
from Tkinter import *
from TestModule import *
class CallModule:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.bCall = Button(frame, text = "Next", command =
self.callModule)
self.bCall.pack(side = LEFT)
self.bQuit = Button(fram, text = "Quit", command =
frame.quit)
self.bQuit.pack(side = LEFT)
def callModule(self):
doNextModule()
root = Tk()
callmodule = CallModule(root)
root.mainloop()
In the second file I have the code below. I would like to know why the
text is not visible when the
window appears but if the "Enter" key is pressed I see the text on my
termonal? TIA. Wayne
from Tkinter import *
class Var:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.field = Entry(frame)
self.field.pack()
self.value = StringVar()
self.value.set("Jean-Paul Sartre")
self.field["textvariable"] = self.value
self.field.bind('<Key-Return>', self.print_value)
def print_value(self, event):
print 'Value is "%s"' % self.value.get()
def doNextModule():
root = Tk()
var = Var(root)
root.mainloop()
More information about the Python-list
mailing list