[Tutor] Executing a GUI from another GUI with a click of a button
Chris Lee
i-scream_cones at hotmail.com
Mon Apr 6 21:30:06 CEST 2009
Hello!
Before I tell you about my problems, I ask for your consideration as I am a newbie at python...
I was having problems as I tried to open another program within a program (both programs are Tkinter UIs)
As for the reference, here is my code:
#program: realprogram.py
from Tkinter import * #Imports the Tkinter module
import os
def showtime():
os.system("clock.py")
window = Tk()
frame = Frame(window)
frame.pack()
clock_command = lambda : showtime()
b3 = Button(frame, text="What time is it?", command=clock_command)
b3.pack()
window.mainloop()
And the following code is the clock.py:
#program: clock.py
import Tkinter
import time
currenttime = ''
clock = Tkinter.Label()
clock.pack()
def tick():
global currenttime
newtime = time.strftime('%H:%M:%S')
if newtime != currenttime:
currenttime = newtime
clock.config(text=currenttime)
clock.after(200, tick)
tick()
clock.mainloop()
I know for certain that the "clock.py" works (because i got it from the web.. -_-;;)
but I'm having a real difficulty trying to open clock.py through my real program....
I know you're busy and everything, but I REALLY hope you can help me soon...
_________________________________________________________________
Create a cool, new character for your Windows Liveā¢ Messenger.
http://go.microsoft.com/?linkid=9656621
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090406/d9c6cdb0/attachment.htm>
More information about the Tutor
mailing list