Leo requires tkinter module to be configured in Python environment

65 views
Skip to first unread message

Viktor Ransmayr

unread,
Dec 28, 2019, 1:26:09 PM12/28/19
to leo-e...@googlegroups.com
Hello Edward, hello Matt,

I just noticed something interesting/ strange/ weird.

Actually two issues:

First: Leo requires that the tkinter module is configured in the Python installation.

(Backgound: I just upgraded to Python 3.7.6 - and - decided to de-select everything but pip ...)

Second: I noticed this only, when I started w/o an existing '~/.leo' directory.

The traceback I receive is:

(Leo-devel) PS C:\Users\Viktor\pyve\github\Leo-devel> leo-m

--global-docks: False

Traceback (most recent call last):
  File "C:\Users\Viktor\PyVE\GitHub\Leo-devel\Scripts\leo-m-script.py", line 11, in <module>
    load_entry_point('leo', 'console_scripts', 'leo-m')()
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\runLeo.py", line 73, in run
    g.app.loadManager.load(fileName, pymacs)
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoApp.py", line 2512, in load
    lm.doPrePluginsInit(fileName, pymacs)
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoApp.py", line 2691, in doPrePluginsInit
    lm.initApp(verbose)
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoApp.py", line 2914, in initApp
    g.app.setLeoID(verbose=verbose)
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoApp.py", line 1157, in setLeoID
    self.setIdFromDialog()
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoApp.py", line 1244, in setIdFromDialog
    dialog = g.TkIDDialog()
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoGlobals.py", line 526, in __init__
    super().__init__(self.title, self.message)
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoGlobals.py", line 446, in __init__
    self.createTopFrame()
  File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\core\leoGlobals.py", line 538, in createTopFrame
    import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'
(Leo-devel) PS C:\Users\Viktor\pyve\github\Leo-devel>


As soon as I re-use my previously saved '~/.leo' directory, the ModuleNotFoundError disappears ...

Can you please explain

* why the module 'tkinter' is required, although PyQt is used as the GUI framework - and -

* secondly, why the problem goes away, if I'm using "old/ saved" '~/.leo' content ...

With kind regards,

Viktor

Viktor Ransmayr

unread,
Dec 30, 2019, 2:55:41 PM12/30/19
to leo-e...@googlegroups.com
Hello Edward, hello Matt,

Am Sa., 28. Dez. 2019 um 19:26 Uhr schrieb Viktor Ransmayr <viktor....@gmail.com>:

I just noticed something interesting/ strange/ weird.

Actually two issues:

First: Leo requires that the tkinter module is configured in the Python installation.

(Backgound: I just upgraded to Python 3.7.6 - and - decided to de-select everything but pip ...)

Second: I noticed this only, when I started w/o an existing '~/.leo' directory.

The traceback I receive is:

...


As soon as I re-use my previously saved '~/.leo' directory, the ModuleNotFoundError disappears ...

Can you please explain

* why the module 'tkinter' is required, although PyQt is used as the GUI framework - and -

Analyzing Leo's content & dependencies a bit more, I found at least one reason myself:

* Leo does support the GUI-Options: [ browser | console | null | qt ] - and - at least the console option does require 'tkinter' as well.

So this now looks only like a possible future 'refactoring' task to me, in case a split into smaller sub-components/-packages is ever planned for Leo ...
 
* secondly, why the problem goes away, if I'm using "old/ saved" '~/.leo' content ...

This is the remaining question I'd really would like to get an explanation.

With kind regards,

Viktor

vitalije

unread,
Dec 30, 2019, 4:03:56 PM12/30/19
to leo-editor
This is the remaining question I'd really would like to get an explanation.

Most likely Tkinter is used only to ask user for leo-id if there is no one to be found. It is located in the ~/.leo folder. When you restore your folder, Leo knwos your leo-id and doesn't need to ask you so there is no need for Tkinter.

Try adding an empty ~/.leo folder and put the `.leoID.txt` file inside, and in this file just write your login name.

HTH Vitalije

Viktor Ransmayr

unread,
Dec 31, 2019, 11:45:27 AM12/31/19
to leo-editor
Hello Vitalije,
You were right with your assumption. - I tried it both with Leo 6.1-final as well as 6.2-b1-devel - and - it works as you suspected.

In both cases it does throw a type error related to ...\spellCommands.py - but - it does open the workbook.leo outline.

Thanks a lot for your explanation!

With kind regards,

Viktor

PS: Just for the record - Here's the startup log for Leo 6.2-b1-devel:

Leo Log Window
Leo 6.2-b1-devel
Python 3.7.6, PyQt version 5.12.6
Windows 10 AMD64 (build 10.0.18362) SP0
current dir
: C:/Users/Viktor/pyve/github/Leo-devel
load dir
: C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/core
global config dir: C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/config
home dir
: C:/Users/Viktor
reading settings
in C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/config/leoSettings.leo
Do spellpyx.txt file found
unexpected error creating
: None

Traceback (most recent call last):


 
File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\commands\spellCommands.py", line 62, in create
    f
= open(fn, mode='wb')

TypeError: expected str, bytes or os.PathLike object, not NoneType

reading settings
in C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/doc/CheatSheet.leo




Brian Theado

unread,
Jan 1, 2020, 5:09:44 PM1/1/20
to leo-editor
Viktor,

On Tue, Dec 31, 2019 at 11:45 AM Viktor Ransmayr <viktor....@gmail.com> wrote:
You were right with your assumption. - I tried it both with Leo 6.1-final as well as 6.2-b1-devel - and - it works as you suspected.

In both cases it does throw a type error related to ...\spellCommands.py - but - it does open the workbook.leo outline.

Looks like you ran into issue https://github.com/leo-editor/leo-editor/issues/1453. I just posted a comment there stating that the attempted fix for that issue did not work. 
 
Thanks a lot for your explanation!

With kind regards,

Viktor

PS: Just for the record - Here's the startup log for Leo 6.2-b1-devel:

Leo Log Window
Leo 6.2-b1-devel
Python 3.7.6, PyQt version 5.12.6
Windows 10 AMD64 (build 10.0.18362) SP0
current dir
: C:/Users/Viktor/pyve/github/Leo-devel
load dir
: C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/core
global config dir: C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/config
home dir
: C:/Users/Viktor
reading settings
in C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/config/leoSettings.leo
Do spellpyx.txt file found
unexpected error creating
: None
Traceback (most recent call last):

 
File "c:\users\viktor\pyve\github\leo-devel\devel\leo-editor-devel\leo\commands\spellCommands.py", line 62, in create
    f
= open(fn, mode='wb')

TypeError: expected str, bytes or os.PathLike object, not NoneType

reading settings
in C:/users/viktor/pyve/github/leo-devel/devel/leo-editor-devel/leo/doc/CheatSheet.leo




--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/0214f56c-76bf-4c44-a55e-cddb740333ca%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages