Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is the differences between tkinter in windows and Tkinter in the other platform?

1 view
Skip to first unread message

Hidekazu IWAKI

unread,
Dec 14, 2009, 10:02:09 AM12/14/09
to pytho...@python.org
Hi, I'm hidekazu.

I'm making a Tk application with python.
In the below code, the class App was inherited from Tkinter.Tk and the
__init__ method calls Tk's constructor with `super` method. In windows,
this code is valid (but, Tkinter -> tkinter).

Why does this code happen a type error in not windows platform?

thank you.

#--------------------------------------------------------
from Tkinter import *

class App(Tk):
def __init__(self):
super(Tk,self).__init__()

App().mainloop()

#Traceback (most recent call last):
# File "./app.py", line 16, in <module>
# App().mainloop()
# File "./app.py", line 7, in __init__
# super(Tk,self).__init__()
#TypeError: super() argument 1 must be type, not classobj

/////////////////////////////////////////////////
岩城 秀和(いわき ひでかず)
e-mail: iw...@iwakihidekazu.net
/////////////////////////////////////////////////

Peter Otten

unread,
Dec 14, 2009, 10:44:19 AM12/14/09
to
Hidekazu IWAKI wrote:

> Hi, I'm hidekazu.
>
> I'm making a Tk application with python.
> In the below code, the class App was inherited from Tkinter.Tk and the
> __init__ method calls Tk's constructor with `super` method. In windows,
> this code is valid (but, Tkinter -> tkinter).
>
> Why does this code happen a type error in not windows platform?
>
> thank you.
>
> #--------------------------------------------------------
> from Tkinter import *
>
> class App(Tk):
> def __init__(self):
> super(Tk,self).__init__()
>
> App().mainloop()
>
> #Traceback (most recent call last):
> # File "./app.py", line 16, in <module>
> # App().mainloop()
> # File "./app.py", line 7, in __init__
> # super(Tk,self).__init__()
> #TypeError: super() argument 1 must be type, not classobj

In Python 2.x Tkinter uses classic classes (classes that do not inherit from
object), and super() can't handle these. In 3.x classic classes are gone,
and tkinter uses newstyle classes. So the behaviour changes from 2.x to 3.x,
but should be the same on all platforms.

Peter

Terry Reedy

unread,
Dec 14, 2009, 1:19:18 PM12/14/09
to pytho...@python.org
On 12/14/2009 10:02 AM, Hidekazu IWAKI wrote:
> Hi, I'm hidekazu.
>
> I'm making a Tk application with python.
> In the below code, the class App was inherited from Tkinter.Tk and the
> __init__ method calls Tk's constructor with `super` method. In windows,
> this code is valid (but, Tkinter -> tkinter).
>
> Why does this code happen a type error in not windows platform?

You question is not clear.
Specify system and Python version is both cases.
Note that Tkinter in 2.x was renamed tkinter in 3.x.
This difference has nothing to do with the platform.

tjr

>
> thank you.
>
> #--------------------------------------------------------
> from Tkinter import *
>
> class App(Tk):
> def __init__(self):
> super(Tk,self).__init__()
>
> App().mainloop()
>
> #Traceback (most recent call last):
> # File "./app.py", line 16, in<module>
> # App().mainloop()
> # File "./app.py", line 7, in __init__
> # super(Tk,self).__init__()
> #TypeError: super() argument 1 must be type, not classobj
>

Hidekazu IWAKI

unread,
Dec 15, 2009, 12:58:50 AM12/15/09
to pytho...@python.org, Terry Reedy
Thank you for your point.
Python versions were difficult. And I didn't know that Tkinter was renamed.

To make sure, I specify their systems.
The system which `tkinter` module has is python 3.11 in Windows XP SP3.
And the other system, which `Tkinter` module has is python 2.51 in Ubuntu
8.04.

I've solved the mistake that even I don't believe.
Thank you very much!

> --
> http://mail.python.org/mailman/listinfo/python-list
>
> ******************************
> XREA.COM -Free Web Hosting-
> http://www.xrea.com/
> ******************************
>

/////////////////////////////////////////////////
岩城 秀和(いわき ひでかず)

e-mail: i.hidekazu at gmail.com
/////////////////////////////////////////////////

0 new messages