DevilWAH
Posts: 14
Joined: Wed Mar 07, 2012 9:56 am
Contact: Website

Building a GUI for Laser Sopirograph in python

Tue Mar 13, 2018 5:14 pm

I am trying to decide the best set of tools to use to create a Graphical user interface on the Pi. The purpose of this is to control external hardware. This hardware is a few PWM controlled motors and relays. Laser shines on a series of 3 mirrors that spin and depending on speed of motors different patterns emerge, (common laser light show technique)

I want to create something like the sketch below, the bottom and right of screen will be touch sensitive buttons and I want the main screen to update in real time with the pattern that will be produced.

Using canvers.HTML seems a good choice for making the user interface. its easy to create and can give a nice interface look and feel.

Tkinket seems a good method to do the drawing of the pattern that I want to be a moving pattern not static. But I am not sure if I can run a Tinker frame with in canvers or if it would be more efficient than Java.

The code I currently have for calculating the pattern requires calculating the current point on 3 circles(mirrors), then advancing the time and recalculating taking in to account the rotation of each circle. I am sure there must be an efficient way to do this, and plot it. rather than what i have been doing which is cacluate each point and join them with a short line. I think what i need it to work out how to deal with vector graphics but thats a task for later.

At the moment I would like to know if I can make a GUI using HTML with embedded Tkinker graphics. Or what other ways coould I look at to make a GUI (touch screen) with a graphicly window that is reasonable efficient?

Image
Attachments
Spirograph.png
Spirograph.png (17.02 KiB) Viewed 425 times

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

Re: Building a GUI for Laser Sopirograph in python

Tue Mar 13, 2018 9:05 pm

Short answer is no. You can't have a tkinter widget inside a webpage.
A web browser doesn't have anyway to process the python code.
Use JavaScript.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Return to “General programming discussion”