Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21155

How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?

From John Salerno <johnjsal@gmail.com>
Newsgroups comp.lang.python
Subject How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"?
Date 2012-03-02 17:48 -0800
Organization http://groups.google.com
Message-ID <29015333.101.1330739333318.JavaMail.geo-discussion-forums@vbbgt10> (permalink)

Show all headers | View raw


According to the Python docs, the way to use tkinter.ttk is this:

from tkinter import *
from tkinter.ttk import *

But what if I don't like this import method and prefer to do:

import tkinter as tk

How then do I utilize tkinter.ttk using the same name? Or is that not possible? Will I have to use to separate names, like this:

import tkinter as tk
import tkinter.ttk as ttk

Is that the only way?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? John Salerno <johnjsal@gmail.com> - 2012-03-02 17:48 -0800
  Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? Terry Reedy <tjreedy@udel.edu> - 2012-03-02 21:47 -0500
    Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? Ben Finney <ben+python@benfinney.id.au> - 2012-03-03 14:34 +1100
    Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? John Salerno <johnjsal@gmail.com> - 2012-03-02 21:06 -0800
      Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? Rick Johnson <rantingrickjohnson@gmail.com> - 2012-03-04 17:39 -0800
        Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? Westley Martínez <anikom15@gmail.com> - 2012-03-04 18:04 -0800
        Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? John Salerno <johnjsal@gmail.com> - 2012-03-04 21:53 -0800
      Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? Kevin Walzer <kw@codebykevin.com> - 2012-03-04 20:58 -0500
    Re: How do you use the widgets in tkinter.ttk if you want to "import tkinter as tk"? John Salerno <johnjsal@gmail.com> - 2012-03-02 21:06 -0800

csiph-web