rjhazeld
Posts: 38
Joined: Mon Feb 16, 2015 9:19 am

Can tkinter gui be embedded in an html page ?

Tue Mar 03, 2015 9:01 pm

I'm new to coding and Rpi so forgive me if this is a stupid question or in the wrong place.
I have just succeeded in getting a Rpi cambot, based on an old rc truck, working via a python script which generates a tkinter GUI. I can control the 4 motors on i2c and have several buttons to start and stop streaming, take stills etc. via commands to run scripts via vnc over our lan but this has limitations in as much as I am only able to change one control at a time. Ideally I want to use my Android based phone as the controller. I have set up mjpg-streamer to give a video stream that is accessible via web browser. The next step would appear to be to build an html page that combines the video stream and the GUI. which would remove the need to use vnc for this purpose.

Any advice, links to good example code etc. would be greatly appreciated. I have built a few basic web pages and one with a feedback form but this is a bit more complex than I have tackled before!!

scotty101
Posts: 3777
Joined: Fri Jun 08, 2012 6:03 pm

Re: Can tkinter gui be embedded in an html page ?

Wed Mar 04, 2015 9:35 am

You cannot use Tkinter GUIs in a webpage.

You will need to re-write the graphical section of your project to be html buttons (or similar) which send commands to a background process which controls the motors.

See http://raspberrywebserver.com/gpio/pifa ... ry-pi.html
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

rjhazeld
Posts: 38
Joined: Mon Feb 16, 2015 9:19 am

Re: Can tkinter gui be embedded in an html page ?

Wed Mar 04, 2015 9:46 am

Thanks for the reply and the link which looks really helpful.
Currently the motors are controlled by sliders can they be replicated in html?

scotty101
Posts: 3777
Joined: Fri Jun 08, 2012 6:03 pm

Re: Can tkinter gui be embedded in an html page ?

Wed Mar 04, 2015 9:49 am

Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

rjhazeld
Posts: 38
Joined: Mon Feb 16, 2015 9:19 am

Re: Can tkinter gui be embedded in an html page ?

Wed Mar 04, 2015 2:21 pm

That's great, thank you. Hopefully I can work out the necessary code from the examples....more midnight oil to be burned!!

headsup_popup
Posts: 1
Joined: Sat Jan 13, 2018 11:50 am

Re: Can tkinter gui be embedded in an html page ?

Sat Jan 13, 2018 12:00 pm

I know this is an old post but for reference Tkinter can be displayed in a webpage. Check out CloudTk for an example

https://wiki.tcl.tk/41972

It can display Tkinter and other X11 apps in a browser. It also runs on the Raspbery Pi.

Kind Regards

Return to “Automation, sensing and robotics”