aijam
Posts: 6
Joined: Mon Sep 17, 2012 10:59 pm

start gui auto

Wed May 15, 2013 1:39 am

I hope rpi starts up a tkinter gui program auto after rpi boot.

If I run this file.py in console.
_tkinter.TclError: no display name and no $DISPLAY environment variable

But I don't wanna startx or starlxde because of the performance of rpi.

I have tested Java 8 preview for ARM hf.
And jar can run in console.

User avatar
mrpi64
Posts: 931
Joined: Sat Feb 16, 2013 5:13 pm

Re: start gui auto

Wed May 15, 2013 7:31 am

i think if you turn the file into an executable, and then change the last line(I THINK) in '/etc/profile' (AKA: put in the command ./script-name), it might work.

turn the file into executable by:

chmod -x script-name.py

then edit the profile file using:
sudo nano /etc/profile

hope this helps:
mrpi64
I'm happy to help.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: start gui auto

Wed May 15, 2013 8:07 am

So far as I can Google, Tk requires an X server to be running. There is no implementation of Tk for a simple framebuffer such as the text console. It is possible to strip down your X session to the bare minimum -- no desktop manager, maybe no window manager (or maybe use something truly tiny such as twm.) But you will still need startx.

User avatar
DaveDriesen
Posts: 113
Joined: Sun Mar 31, 2013 8:28 pm
Location: Top of the food chain
Contact: Website

Re: start gui auto

Wed May 15, 2013 9:09 am

Thanks -- just a note on the following:
turn the file into executable by:
chmod -x script-name.py
To make your file executable you would need chmod +x
(chmod -x turns the executable bit off, not on) :)

Also you can research /etc/rc.local for starting stuff at boot

Dave Driesen
Linux dev and oldskool elite

aijam
Posts: 6
Joined: Mon Sep 17, 2012 10:59 pm

Re: start gui auto

Thu May 16, 2013 2:21 pm

rurwin wrote:So far as I can Google, Tk requires an X server to be running. There is no implementation of Tk for a simple framebuffer such as the text console. It is possible to strip down your X session to the bare minimum -- no desktop manager, maybe no window manager (or maybe use something truly tiny such as twm.) But you will still need startx.
I installed twm and add a .xinitrc under home directory.

.xinitrc
exec twm
python test.py

It works after log in.

Thanks.

aijam
Posts: 6
Joined: Mon Sep 17, 2012 10:59 pm

Re: start gui auto

Thu May 16, 2013 2:25 pm

mrpi64 wrote:i think if you turn the file into an executable, and then change the last line(I THINK) in '/etc/profile' (AKA: put in the command ./script-name), it might work.

turn the file into executable by:

chmod -x script-name.py

then edit the profile file using:
sudo nano /etc/profile

hope this helps:
mrpi64
I also modified /etc/profile.
But after log in, console print some error.
It means Tk still need a X environment.

Return to “Python”