[newbie] struggling wth tkinter

Jean Dubois jeandubois314 at gmail.com
Sun Dec 8 10:15:12 CET 2013


Op zondag 8 december 2013 08:49:22 UTC+1 schreef Chris Angelico:
> On Sun, Dec 8, 2013 at 6:40 PM, Jean Dubois <jeandubois314 at gmail.com> wrote:
> 
> > coolens at antec2:~$ python3 feet2meters.py
> 
> > ImportError: No module named Tkinter
> 
> 
> 
> In Python 3, the module's named tkinter instead of Tkinter. You should
> 
> be able to do the exact same import but with the lower-case name, or
> 
> if you need to support both:
> 
> 
> 
> try:
> 
>     import tkinter as tk
> 
> except ImportError:
> 
>     import Tkinter as tk
> 
This seems a very nice approach, but can you tell me how I should change the import-section as a whole; I tried it like here below (but that's certainly not the right way):


try:
    import tkinter as tk
except ImportError:
    import Tkinter as tk
from tk import *
import ttk

thanks in advance
jean



More information about the Python-list mailing list