Discussion:
[Tkinter-discuss] Where is tkinter.py
Pierre Dagenais
2013-12-22 01:10:39 UTC
Permalink
Hi,
I'm new at this stuff and I'm trying to understand what I'm doing! I
thought that when I executed "tkinter import" a file called tkinter.py
(a class) would be loaded for execution. Except when I search my system,
Ubuntu 12.04, all I find is Tkinter.py in the 2.7 directory, python3.3
has no equivalent tkinter.py?
Can somebody explain?

TU,

PierreD.
Ned Deily
2013-12-22 01:45:38 UTC
Permalink
In article <52B63C0F.2080205 at ncf.ca>,
Post by Pierre Dagenais
I'm new at this stuff and I'm trying to understand what I'm doing! I
thought that when I executed "tkinter import" a file called tkinter.py
(a class) would be loaded for execution. Except when I search my system,
Ubuntu 12.04, all I find is Tkinter.py in the 2.7 directory, python3.3
has no equivalent tkinter.py?
Can somebody explain?
Ubuntu chooses to package tkinter separately from Python, giving you the
option to not have to pull in Tcl, Tk, and all of their dependencies if
you don't need them. Try installing the python3-tk package, for example:

sudo apt-get install python3-tk
--
Ned Deily,
nad at acm.org
Guido van Rossum
2013-12-22 03:18:27 UTC
Permalink
Typically what I do in such a case is go into the interactive Python
interpreter, import the module, and then print it.

E.g. for Python 2.7 on OSX:

$ python
Python 2.7.6+ (2.7:313d9bb253bf, Nov 25 2013, 14:05:28)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Post by Pierre Dagenais
import tkinter
import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tkinter
Post by Pierre Dagenais
import Tkinter
import Tkinter
Post by Pierre Dagenais
Tkinter
Tkinter
<module 'Tkinter' from '/usr/local/lib/python2.7/lib-tk/Tkinter.pyc'>
And for 3.4:

$ python3
python3
Python 3.4.0b1 (v3.4.0b1:3405dc9a6afa, Nov 24 2013, 16:45:59)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Post by Pierre Dagenais
import Tkinter
import Tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'Tkinter'
Post by Pierre Dagenais
import tkinter
import tkinter
Post by Pierre Dagenais
tkinter
tkinter
<module 'tkinter' from '/usr/local/lib/python3.4/tkinter/__init__.py'>
Post by Pierre Dagenais
Hi,
I'm new at this stuff and I'm trying to understand what I'm doing! I
thought that when I executed "tkinter import" a file called tkinter.py
(a class) would be loaded for execution. Except when I search my system,
Ubuntu 12.04, all I find is Tkinter.py in the 2.7 directory, python3.3
has no equivalent tkinter.py?
Can somebody explain?
TU,
PierreD.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
--
--Guido van Rossum (python.org/~guido)
Pierre Dagenais
2013-12-22 21:22:50 UTC
Permalink
Thank you all,
Post by Pierre Dagenais
PierreD.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
Loading...