SETUP
I have a python3 application that creates a gui using tkinter. It runs on a Raspberry Pi 4 running Ubuntu 21.10. I'm connected using a remote desktop with the xrdp client. I successfully connect to the Ubuntu desktop, but I can't see desktop icons.
PROBLEM
When I launch the application with root privileges, tkinter gets confused on the display and fails to create the GUI.
sudo python3 /home/ubuntu/Robotics/QuadrupedRobot/StanfordQuadruped/calibrate_tool.py
When I run the application as user, tkinter is able to create the GUI, but now the application does not have permission to interface with root drivers
python3 /home/ubuntu/Robotics/QuadrupedRobot/StanfordQuadruped/calibrate_tool.py
QUESTION
Is there a way to make tkinter work with root permissions on remote desktop, or to write on root files without giving root permission to the full application?
Is there a something I'm doing wrong with the setup?
SOLUTION