File Transfer Need Help
vincent wehren
vincent at visualtrans.de
Sat Jul 24 03:37:10 EDT 2004
ADE wrote:
> Hi everyone well from my last post I found what I am looking for
>
> I have some code now that transfers files
>
> I have added a GUI to it and need some help with two things one my
> loadtemplate() function if I run it won't open the filetypes I just get the
> error message from tkMessageBox but its the right filetype
The problem is the line: self.settings["template"].set(filename)
This line is out of context. You're not within a class with a "member
variable" called settings. What are you trying to accomplish?
Aren't you looking for somthing like:
...
filename = tkFileDialog.askopenfilename(filetypes=(
("TIFF", ".tiff"), ("JPG", ".jpg"),
("GIF", ".gif")))
try:
sendfile(filename)
except:
tkMessageBox.showerror("Some error sending %" % filename)
...
Of course to do so, you need to change the sendfile() function to a
function that takes 'filename' as argument. As a result, there's no
need for a global variable FILE anymore -- which may solve your 2nd problem:
def sendfile(filename):
...
--
Vincent Wehren
More information about the Python-list
mailing list