Tkinter GUI does not run properly after auto boot - python

I tried the solution provided in Tkinter GUI does not run properly when auto boot Tkinter, however GUI does not run properly when auto boot and got my python script with tkinter to run correctly and automatically after reboot.
The GUI interface kind of disappear. I get a black background, shows "Open Box" application when I tried to close, instead of the normal menu and wall paper. I can still right click and open web browser and a terminal. I tried running "startx" from terminal after some googling but received an error message.
How do I get the raspbian GUI interface working with the solution provided in link above? Any help is very much appreciated.
#!/usr/bin/python
chmod +x /home/pi/Desktop/test.py
nano /home/pi/.config/lxsession/LXDE-pi/autostart
#/home/pi/Desktop/test.py

Related

How do I make a console window appear when I run a python script from TkInter UI so I can post messages to track progress?

The python script takes some time to run so I want a console window to appear and somehow print messages to it while the program is running. At the moment I have a tkinter that pops up and when I hit "Run" - I do not know if it's working or if it is hanging. How do I force a console window?
Thank you.

Tkinter GUI does not run properly when auto boot

this is my first time using Raspberry Pi 3 with Python Tkinter to make a GUI.
I have written my script using Python. My code uses Raspberry Pi 3 GPIO 8 and GPIO 11 as inputs. I have 2 relay connected to the 2 inputs terminal. The relay will act as a switch. My code will count how many times the relay have switched on and display in the GUI.
I have tested it using Raspberry Pi 3 LxTerminal with
sudo python /home/pi/Desktop/test.py
The GUI opens and it works perfectly. Every time the relay switches, the count +1.
Then I decided to make it auto boot every time I reboot my Pi. I uses the following technique.
sudo nano /etc/profile
Then add the following code to the final line and save it.
sudo python /home/pi/Desktop/test.py
I reboot my Raspberry Pi and the GUI boot automatically. But the GUI does not response to the relay switching.
I tried rebooting a few times and it worked after a few reboot. Then I tried to reboot again and the next time it does not work again. This steps keep repeating over and over again. Some times the GUI work, some times it doesn't.
Anyone have come across this sorts of problem? What should I do to make the GUI auto boot to works 100%?
NOTE:
Having 5V 1A phone charger to supply power to Pi. (Tried using 5V 2.1A as well)
Connected a HDMI to VGA converter to connect to a monitor
Does not have keyboard and mouse when the GUI is set to auto boot
I have a tkinter GUI that boots on startup on my Raspberry Pi. I did it by adding it to autostart file.
First, make the script executable. Add
#!/usr/bin/python
as the first line of your python script.
Then use this command to make the file executable
chmod +x /home/pi/Desktop/test.py
Now you should be able to start your program without the "sudo python" prefix. Just typing /home/pi/Desktop/test.py in the terminal should boot your program.
Then open autostart file for editing with
nano /home/pi/.config/lxsession/LXDE-pi/autostart
and add
#/home/pi/Desktop/test.py
BTW: you are using "sudo" way to much. You should use sudo very rarely. If you edit user files with sudo you can screw up your file permissions, which leads to very strange bugs. You should need "sudo" when you are installing something, and that's about it.
First of all a Hardware recommendation: sorry for quoting a german page but as shown here https://www.elektronik-kompendium.de/sites/raspberry-pi/1912111.htm your raspi 3 should have minimun a power supply from 5v and 2A but it would be perfect if it supports up to 3A. But thats just some side info.
For me this question PyQt: How to run GUI on Raspberry Pi desktop startup? helped me solving the GUI autostart problem.

In Pycharm, Slow mouse interface(e.q. click button) when connecting server with terminal

I have a difficulty with developing with pycharm (absolutely just installing pycharm)
I download "pycharm 2016.1" and initiate "pycharm.sh".
but I cannot do anything, because click interface is not working in the program window. It is very slowwwwwwwww.
Maybe, I think that it is setting problem. Does anyone know this problem?

wmctrl bring on top doesn't work over fullscreen app

I've got a strange issue with wmctrl : I'm trying to bring on top a virtual keyboard with by clicking on a button in another application (GUI app), but it seems not to work.
The other application (the GUI) is in Python created with the tkinter module.
It's strange because when the GUI is not in fullscreen mode it works fine, the Keyboard is bringing on top of the GUI. But when the GUI is set in fullscreen mode nothing appends, and I didn't get any error.
So if you have an idea I'm listening :)
thkx

lightdm startup script to change locale on raspberry pi with curses

I've written a script that uses python curses to allow me to change the locale (edits /etc/default/locale) on the raspberry pi. It has a basic menu that allows me to select the language.
I want to run this script before the lxde session starts. I've tried editing the /etc/lightdm/lightdm.conf file but when I do, the pi doesn't boot at all, it just has a black screen with a blinking cursor.
Am I approaching this the right way? Is there a better way to run an interactive python curses before lxde starts?
Try using crontab in Linux. You could launch the program at booting:
https://en.wikipedia.org/wiki/Cron

Categories