Reks MW
Reks MW

Reputation: 21

_tkinter.TclError: invalid command name "::msgcat::mcmset

Tried to use ttkbootstrap in pydroid and got this error message below:

Traceback (most recent call last):

  File "/data/user/0/ru.iiec.pydroid3/files/temp_iiec_codefile.py", line 5, in <module>
    base = ttk.Window()
           ^^^^^^^^^^^^
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.11/site-packages/ttkbootstrap/window.py", line 279, in __init__
    self._style = Style(themename)
                  ^^^^^^^^^^^^^^^^
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.11/site-packages/ttkbootstrap/style.py", line 489, in __init__
    localization.initialize_localities()

  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.11/site-packages/ttkbootstrap/localization/msgs.py", line 9, in initialize_localities
    m.initialize()

  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.11/site-packages/ttkbootstrap/localization/msgs.py", line 27, in initialize
    MessageCatalog.set_many(self.locale, *messages)

  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.11/site-packages/ttkbootstrap/localization/msgcat.py", line 142, in set_many
    return int(root.tk.eval(out))
               ^^^^^^^^^^^^^^^^^
_tkinter.TclError: invalid command name "::msgcat::mcmse
t"

I can't figure out how to solve this problem or if it can even be solved. Any help would be appreciated. Oh and this error pops up even with a script as simple as:

import tkinter as tk
#from tkinter import ttk
import ttkbootstrap as ttk

base = ttk.Window()
base.mainloop()

So it's nothing to do an error in my script.

Upvotes: 2

Views: 273

Answers (1)

ama
ama

Reputation: 120

That error originates from the pydroid's tcl interpreter not implementing the tcl ::msgcat:: message catalog. The command uses to register localized translations to the tk message catalog, It is called by ttkbootstrap on window creation, but i do not think that needed on pydroid, so disable it!

Add this at the beginning of your code:

import ttkbootstrap.localization
ttkbootstrap.localization.initialize_localities = bool

The bool at the end is just a dummy function and should not actually do anything.

Upvotes: 0

Related Questions