Ashnook13
Posts: 82
Joined: Wed Sep 26, 2012 3:43 pm

GUI Question

Wed Aug 02, 2017 8:55 am

I want to create a program for my Pi which when powered up comes up as a Use Interface for a ventilation system. I don't want it to run within the current Raspbian UI but on it's own. I have configured a Pi with a 5 inch touch screen display.

I have looked at Tkinter but this seems to always want to run inside the Raspbian UI. Not sure I care what I write it in (python, C etc.).

Any recommendations please?

Thanks, Brian

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: GUI Question

Wed Aug 02, 2017 9:10 am

TKinter with python is relatively simple.

Page 44 in https://www.raspberrypi.org/magpi-issues/MagPi29.pdf has a tutorial.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Ashnook13
Posts: 82
Joined: Wed Sep 26, 2012 3:43 pm

Re: GUI Question

Wed Aug 02, 2017 9:25 am

Hi Dougie, yes it is, I have played with it but I cannot see a way for a created dialog to be the only display on a full screen.

The dialog/window will contain items/controls for the system and I don't want to see any of the Raspbian window widgets. Also we are susceptible to power cuts here so if the pi re-boots I want the Tkinter system to come back up and be running as normal.

Brian

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: GUI Question

Wed Aug 02, 2017 9:47 am

You can make TKinter windows with no controls (so they run like a kiosk).
Lots of Stackoverflow examples for that https://www.google.co.uk/search?q=tkint ... w+controls

The other way to do a GUI is HTML/CSS/JavaScript and run that in a kiosk mode web browser (KWeb probably fits that best). If you serve that stuff from a small web server you can make a dynamic kiosk GUI.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Ashnook13
Posts: 82
Joined: Wed Sep 26, 2012 3:43 pm

Re: GUI Question

Wed Aug 02, 2017 9:54 am

OK, that looks like what I want to do. I want to continue with a python based language if possible as I have lots do do controlling the Pi behind the front window.

Will experiment!!!

Thanks Dougie.

Ashnook13
Posts: 82
Joined: Wed Sep 26, 2012 3:43 pm

Re: GUI Question

Wed Aug 02, 2017 11:38 am

I am still a bit confused Dougie, I cannot see anything from the search link you gave me that allows Tkinter code to replace the Raspbian top level gui with mine? That is make a Tk inter developed window automatically be the top level window with stuff within it. I don't mind if the Raspbian top level has to loaded first then automatically start my Tk python code to overwrite it or just sit in to of it (all of it). (ho do I do that???).

Are then any simple examples around you can point me to?

Cheers, Brian

treeHouse
Posts: 29
Joined: Sat Aug 06, 2016 2:35 am

Re: GUI Question

Thu Aug 03, 2017 4:53 am

Here is an old thread discussing this very issue.
viewtopic.php?t=7709

Seems SDL is what you want, though they suggest using C or C++.
I believe PyGame uses SDL, so maybe you can use python after all.

User avatar
DougieLawson
Posts: 36576
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: GUI Question

Thu Aug 03, 2017 10:03 am

If you don't start the desktop, but start Xwindows with just a single application that'll give you what you want.

To experminent set-up Raspbian to login to a command prompt only (it's a Raspi-Config option). Then try a startx /home/pi/mygui.program.py command.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Ashnook13
Posts: 82
Joined: Wed Sep 26, 2012 3:43 pm

Re: GUI Question

Thu Aug 03, 2017 10:48 am

Thanks again Dougie, I have decided to go with the standard desktop with my GUI filling to space under the tool-bar. I now know how to automatically start a python program when the gui boots so I am getting there.

I found a link to a gui-builder called wxpython but not sure if it is supported on the pi, will look further.

Brian

Return to “General discussion”