• Re: Tkinter - cannot import tklib

    From Stefan Ram@21:1/5 to Wolfgang Grafen on Mon Jun 20 23:07:08 2022
    Wolfgang Grafen <wolfgang.grafen@gmail.com> writes:
    ModuleNotFoundError: No module named 'tklib'

    It is possible that some tklib widgets are available under
    "tkinter.ttk" now. (Also check out tkinter.tix.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang Grafen@21:1/5 to All on Mon Jun 20 15:43:26 2022
    Hello all,

    I am an experienced Python user and struggle with following statement:

    from tklib import *
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'tklib'

    I tried to import tklib as shown above on following of my Python installations: Anaconda Python 3.8.3, Portable Python 3.9, Python 3.10.1, Python 2.7.10 with the same negative result.

    I also tried to find help by googling - without success. Also I did not find a python module called tklib to install. Tkinter, ttk is working fine.

    There are numerous examples using "from tklib import *" so I assume it works for most. In the tk-tutorial below tklib is used without special explanation, so I assume it should be installed by default with every python installation which has Tkinter
    integrated.

    https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app#

    First time that I cannot help myself. Please help, what do I do wrong?

    Greetings
    Wolfgang

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From MRAB@21:1/5 to Wolfgang Grafen on Tue Jun 21 01:03:10 2022
    On 2022-06-20 23:43, Wolfgang Grafen wrote:
    Hello all,

    I am an experienced Python user and struggle with following statement:

    from tklib import *
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'tklib'

    I tried to import tklib as shown above on following of my Python installations: Anaconda Python 3.8.3, Portable Python 3.9, Python 3.10.1, Python 2.7.10 with the same negative result.

    I also tried to find help by googling - without success. Also I did not find a python module called tklib to install. Tkinter, ttk is working fine.

    There are numerous examples using "from tklib import *" so I assume it works for most. In the tk-tutorial below tklib is used without special explanation, so I assume it should be installed by default with every python installation which has Tkinter
    integrated.

    https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app#

    First time that I cannot help myself. Please help, what do I do wrong?

    I'm thinking that maybe that tutorial is about writing a module (called "tklib") to make it easier to write tkinter applications.

    The tkinter "Text" widget, for example, doesn't have its own scrollbars
    (you have to add them separately and link them to the widget), so
    writing a module that defines a text-with-scrollbars widget is a good idea.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dennis Lee Bieber@21:1/5 to All on Mon Jun 20 20:43:18 2022
    On Mon, 20 Jun 2022 15:43:26 -0700 (PDT), Wolfgang Grafen <wolfgang.grafen@gmail.com> declaimed the following:


    There are numerous examples using "from tklib import *" so I assume it works for most. In the tk-tutorial below tklib is used without special explanation, so I assume it should be installed by default with every python installation which has Tkinter
    integrated.

    https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app#

    First time that I cannot help myself. Please help, what do I do wrong?


    From what I can see, you haven't /written/ a tklib module.

    That tutorial assumes you will create a module containing a number of simplified interfaces to tk widgets. cf: https://tk-tutorial.readthedocs.io/en/latest/radio/radio.html#a-better-radiobutton-class
    tklib.py will contain the definition of the Radiobutton class. The same probably applies everywhere that you see tklib imported -- whatever classes
    are used to create widgets need to be defined in that file.

    https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app# """
    In the following section we are going to redefine the tk and ttk objects.
    To make it easier to use them, we follow these design principles:

    we keep the excact same class names
    the parent object is chosen automatically
    all keyword arguments are forwarded

    The first widget to consider is the Label which just places static text.
    Where it makes sense, a label will be combined with a button or entry
    widget.
    """

    https://tk-tutorial.readthedocs.io/en/latest/check/check.html#a-better-checkbutton-class
    etc.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David@21:1/5 to Wolfgang Grafen on Tue Jun 21 20:32:51 2022
    On Tue, 21 Jun 2022 at 09:22, Wolfgang Grafen <wolfgang.grafen@gmail.com> wrote:

    I am an experienced Python user and struggle with following statement:

    from tklib import *
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'tklib'

    [...]

    I did not find a python module called tklib to install.

    Ok, see below for how to find that file.

    [...]

    I assume it should be installed by default with every python installation

    It appears that your assumption is wrong. It appears to me that the
    missing file is part of the tk-tutorial project.

    https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app#

    First time that I cannot help myself. Please help, what do I do wrong?

    Hi, here is a description how I found the file you seek:

    Go to https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html

    At the top right of the page, see hyperlink "Edit on GitHub".
    Click hyperlink takes you to
    https://github.com/rasql/tk-tutorial/blob/master/docs/intro/intro.rst
    which is the same content rendered from 'rst' format I assume.

    At top left of that page, see hyperlinks "tk-tutorial"/"docs"/"intro"
    and "rasql"/"tk-tutorial".

    Click one of the "tk-tutorial" hyperlinks to go to the top directory
    of the project at:
    https://github.com/rasql/tk-tutorial

    On that page near the very top, see a list of hyperlinks to
    directories and files of the project. One of those hyperlinks
    is labelled "tklib.py". Click that link to see the file at
    https://github.com/rasql/tk-tutorial/blob/master/tklib.py

    On that page, click the "Raw" button. Then you can use "save as"
    in your browser. Or you can just download it by some other
    method from the link given in the previous paragraph.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)