TKinter, buttonwidget response problem(1) and all btns the same size(2)!

Fredrik Lundh fredrik at pythonware.com
Sat Apr 5 12:08:16 EDT 2008


skanemupp at yahoo.se wrote:

> i dont know, i used a piece of code i found which had a createwidgets-
> method. isnt init a function, not a method btw(or it is the same
> thing?)

a method is a function defined inside a class statement, and which is 
designed to be called via an instance of that class.

     def function():
         print "this is a function"

     def Class:
         def method(self):
             print "this is a method"

     function() # calls a function

     obj = Class() # create an instance (call __init__ if present)
     obj.method() # calls a method

__init__ is automatically called when Python creates a new instance.

if you create the widgets inside the init method or inside a separate 
method that's called from the init method (or from the outside) is up
to you.

</F>




More information about the Python-list mailing list