I've decided to mess around with Tkinter and import os a bit. I'm running ubuntu 8.10, if that helps any.
Here is what my program was supposed to do:
have two simple buttons, one labeled 'on' and one labeled 'off'. I wanted the on button to launch nautilus and the off button to quit the program and therefore close nautilus, just as it would if I launched nautilus from the terminal.
What it is actually doing:
As soon as i run the program, nautilus launches, and my window with the buttons don't pop up until after I have closed nautilus. Why is this?
Here is my code:
from Tkinter import * import os class Application(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.grid() self.createWidgets() def createWidgets(self): self.onButton = Button ( self, text="on", command=os.system('nautilus' )) self.onButton.grid(row=0, column=0) self.offButton = Button ( self, text="off", command=self.quit ) self.offButton.grid(row=0, column=1) app = Application() app.master.title("My Application") app.mainloop()
Thanks in advance for your help!