jesuisbenjamin
June 5th, 2010, 12:12 AM
Hello Forum,
I have learnt recently to use Tkinter on Python especially thanks to this tutorial (http://www.builderau.com.au/program/soa/A-Quickstart-to-building-GUI-based-applications-in-Python/0,339024614,339272995,00.htm).
Now i am looking at improving my skills and i came across other tutorials, like this one (http://sebsauvage.net/python/gui/).
Now i am curious because the second tutorial tells me how to create a main window, namely like that:
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import Tkinter
class simpleapp_tk(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
pass
if __name__ == "__main__":
app = simpleapp_tk(None)
app.title('my application')
app.mainloop()
While i can do the same (thanks to the former tutorial) like this:
#!/usr/bin/python
from Tkinter import *
root = Tk()
root.mainloop()
So obviously this is confusing. Am i missing something by using the first tutorial or is it rather that the person who did the second can't really program and keep it simple?
You've guessed i prefer the former. I'm curious of your opinion.
Thanks
I have learnt recently to use Tkinter on Python especially thanks to this tutorial (http://www.builderau.com.au/program/soa/A-Quickstart-to-building-GUI-based-applications-in-Python/0,339024614,339272995,00.htm).
Now i am looking at improving my skills and i came across other tutorials, like this one (http://sebsauvage.net/python/gui/).
Now i am curious because the second tutorial tells me how to create a main window, namely like that:
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import Tkinter
class simpleapp_tk(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
pass
if __name__ == "__main__":
app = simpleapp_tk(None)
app.title('my application')
app.mainloop()
While i can do the same (thanks to the former tutorial) like this:
#!/usr/bin/python
from Tkinter import *
root = Tk()
root.mainloop()
So obviously this is confusing. Am i missing something by using the first tutorial or is it rather that the person who did the second can't really program and keep it simple?
You've guessed i prefer the former. I'm curious of your opinion.
Thanks