[Tutor] Executing a GUI from another GUI with a click of a button

2009-04-06 Thread Chris Lee

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___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Problem with converting Python to EXE using py2exe

2009-04-10 Thread Chris Lee

Hi tutors,

 

So I finally made my program. When I run it with python, it works perfectly!

 

But when I convert it to an executable using py2exe (correctly), I get an error:

 

Traceback (most recent call last):

   File "oentry.py", line 52, in 

   File "Tkinter.pyc", line 3270, in __init__

   File "Tkinter.pyc", line 3226, in __init__

_tkinter.TclError: Couldn't open "base.gif": no such file or directory

 

 

alright,, I know what you're talking about, Mr.Python... I linked an image to 
the python file, but the exe can't find it.. (right?)

 

anyways, here's the snippet of my code which uses the "base.gif"

 

pic = tkinter.PhotoImage

base =  pic(file="base.gif")

 

 

Now, I'm just wondering... for the "base.gif" part, would it be better to write 
out the whole directory?

 

any help would be appreciated. Thanks a bunch!

 

 

-Christopher "script teeny" Lee

_
Share photos with friends on Windows Live Messenger
http://go.microsoft.com/?linkid=9650734___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor