Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
The second dialog just returns the file path of where you want the data to be saved to. You still need to write it to the file.
f = open(filepath, 'w')
f.write(data)
f.close()
If you are working with current versions of Poser you may find wxPython preferable to Tkinter. Also note that Poser has its own built in file dialogs.
Hope that helps.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
hola folks i'm new at python, and fighting my way through tkinter. using 2.7 in 2010
so here's what i have:
import Tkinter,tkFileDialog
root = Tkinter.Tk()
file = tkFileDialog.askopenfile(parent=root,mode='rb',title='Choose a file')
if file != None:
data = file.read()
file.close()
print "I got %d bytes from this file." % len(data)
print data
root.mainloop()
for opening a file. works great.
but all i have found for saving a file is this:
import Tkinter,tkFileDialog
myFormats = [
('text','*.txt'),
]
root = Tkinter.Tk()
fileName = tkFileDialog.asksaveasfilename(parent=root,filetypes=myFormats ,title="Save the file as...")
if len(fileName ) > 0:
print "Now saving"
root.mainloop()
but no luck. it says it's saving (lol, 'cause i told it too) but it does not save anything. i've finegeled it many ways with my itty bitty knowlege set but to no avail. can anyone point me in the correct direction?
go that way really fast.
if something gets in your way
turn