Request Help With pkexec

Wildman best_lay at
Mon Apr 3 15:29:56 EDT 2017

Python 3.4.2
Tkinter 8.6
GCC 4.9.1 on Linux

I am working on a gui program using Tkinter. The program will
have a feature to restart as root.  I am testing different gui
front-ends from a terminal to raise privileges and I want to
be able to use as many as possible for obvious reasons.  Gksu,
kdesudo and su-to-root all work perfectly.  However, I have a
problem with pkexec.  Here is the command I am using from a

$ pkexec python3 /home/user/Python/linfo-tk/

I get this error:

Traceback (most recent call last):
  File "/home/user/Python/linfo-tk/", line 455, in <module>
    root = tk.Tk()
  File "/usr/lib/python3.4/tkinter/", line 1854, in __init__ = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

The display environment variable is set:

$ echo $DISPLAY

And the program displays and works perfectly in every other way.
I would appreciate any insight.

<Wildman> GNU/Linux user #557453
May the Source be with you.

More information about the Python-list mailing list