Python Tkinter execution issues

Hello Everyone,
I am very new to manjaro and pacman and I was unable to find anything about this.
I am trying to run some python-tkinter apps that I wrote earlier on ubuntu and I am getting this error when doing the tkinterr._test() command (similar error with my other programs):

[julius@Pinebook ~]$ python
Python 3.8.3 (default, May 19 2020, 23:51:58) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> dir(tkinter)
['ACTIVE', 'ALL', 'ANCHOR', 'ARC', 'BASELINE', 'BEVEL', 'BOTH', 'BOTTOM', 'BROWSE', 'BUTT', 'BaseWidget', 'BitmapImage', 'BooleanVar', 'Button', 'CASCADE', 'CENTER', 'CHAR', 'CHECKBUTTON', 'CHORD', 'COMMAND', 'CURRENT', 'CallWrapper', 'Canvas', 'Checkbutton', 'DISABLED', 'DOTBOX', 'DoubleVar', 'E', 'END', 'EW', 'EXCEPTION', 'EXTENDED', 'Entry', 'Event', 'EventType', 'FALSE', 'FIRST', 'FLAT', 'Frame', 'GROOVE', 'Grid', 'HIDDEN', 'HORIZONTAL', 'INSERT', 'INSIDE', 'Image', 'IntVar', 'LAST', 'LEFT', 'Label', 'LabelFrame', 'Listbox', 'MITER', 'MOVETO', 'MULTIPLE', 'Menu', 'Menubutton', 'Message', 'Misc', 'N', 'NE', 'NO', 'NONE', 'NORMAL', 'NS', 'NSEW', 'NUMERIC', 'NW', 'NoDefaultRoot', 'OFF', 'ON', 'OUTSIDE', 'OptionMenu', 'PAGES', 'PIESLICE', 'PROJECTING', 'Pack', 'PanedWindow', 'PhotoImage', 'Place', 'RADIOBUTTON', 'RAISED', 'READABLE', 'RIDGE', 'RIGHT', 'ROUND', 'Radiobutton', 'S', 'SCROLL', 'SE', 'SEL', 'SEL_FIRST', 'SEL_LAST', 'SEPARATOR', 'SINGLE', 'SOLID', 'SUNKEN', 'SW', 'Scale', 'Scrollbar', 'Spinbox', 'StringVar', 'TOP', 'TRUE', 'Tcl', 'TclError', 'TclVersion', 'Text', 'Tk', 'TkVersion', 'Toplevel', 'UNDERLINE', 'UNITS', 'VERTICAL', 'Variable', 'W', 'WORD', 'WRITABLE', 'Widget', 'Wm', 'X', 'XView', 'Y', 'YES', 'YView', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_cnfmerge', '_default_root', '_exit', '_flatten', '_join', '_magic_re', '_setit', '_space_re', '_splitdict', '_stringify', '_support_default_root', '_test', '_tkerror', '_tkinter', '_varnum', 'constants', 'enum', 'getboolean', 'getdouble', 'getint', 'image_names', 'image_types', 'mainloop', 're', 'sys', 'wantobjects']
>>> tkinter._test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/tkinter/__init__.py", line 4552, in _test
    root = Tk()
  File "/usr/lib/python3.8/tkinter/__init__.py", line 2261, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: unknown color name "BACKGROUND"
>>> 

tldr: there is an issue with initialising tkinter.

I installed python tkinter with

sudo pacman -Syu tk

as it was suggested on the internet. I also tried with pip but it would not work.

some system information:

  • aarch64 cpu architecture
  • linux 5.7.0 manjaro arm
  • python 3.8.3

thank you in advance and please ask if you have further questions about the setup.
Best Regards, Julius

Hello antman,
thanks for the reply, I looked this error up already, but I wasn't finding any useful information. The problem is that the error is from tkinter/init.py which is not a file that I wrote. Instead, the error comes up when it executes the root = tk.Tk() function.
I looked up /usr/lib/python3.8/tkinter/__init__.py.
This error should not happen when tkinter is installed correctly and it seems like the instruction that I found on the internet don't work for me.
Best Regards, Julius

Please try this out to see if it solves your problem

xrdb -load /dev/null
xrdb -query

2 Likes

Hello Experimenter,
thanks for this reply, it worked!
image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by