using graphical python app with xwindows

Hi all,

I am trying to do 2 things. I have a tkinter python app (graphical python app) that I want to run using the xwindows graphic manager. I just want to run it first, then once I confirm that works I would like to make my python app (and xwindows) run at boot.

I have already installed python3 and xwindows. I tried to run my python app and previously got the error “no display name and no $DISPLAY environment variable” So I typed:

export DISPLAY=:0.0

Now I attempt to run my python app:

sudo python3

from this I get the error "couldn’t connect to display “:0.0”

Perhaps this is from xwindows not running. So I type startx into the terminal and after a few moments the terminal reappears in a slightly different look (gives a bunch of info about dietpi and my system at the top) except that everything is now frozen. I cannot find any key combination that releases me from this view so I have to pull the plug on my raspberry to start over again.

Can anyone explain what is going on and how to get my python app to run?

I think once I figure out the correct terminal commands to run xwindows and my python app, I should be able to copy them into the custom autostart script that dietpi provides, but that’s where I am at currently. Any help is appreciated!