Posts: 232
Threads: 81
Joined: Nov 2021
Jan-28-2022, 09:45 PM
(This post was last modified: Jan-28-2022, 09:45 PM by Extra.)
Saw this cool 1985 Home Automation system GUI ( Link) and I was thinking about replicating it. I was thinking tkinter, or Css and using python or JavaScript to actually control stuff (time, date, weather?)
Any thoughts on how to go about replicating this (what software would be best to use)
Posts: 1,358
Threads: 2
Joined: May 2019
Python and a raspberry pi
Posts: 12,031
Threads: 485
Joined: Sep 2016
Additional info, you can find all kinds of sensors and motors at the following locations:
Seeed Studio
AdaFruit
Pololu
SparkFun
Posts: 7,320
Threads: 123
Joined: Sep 2016
Jan-31-2022, 05:31 AM
(This post was last modified: Jan-31-2022, 05:31 AM by snippsat.)
(Jan-28-2022, 09:45 PM)Extra Wrote: Saw this cool 1985 Home Automation system GUI (Link) and I was thinking about replicating it. I was thinking tkinter, or Css and using python or JavaScript to actually control stuff (time, date, weather?)
Any thoughts on how to go about replicating this (what software would be best to use) There is a lot stuff made for this like eg Home Assistant which is mostly made with Python.
So a common word for this is Internet of Things(IoT),eg Python,Raspberry Pi,Micropython...ect is heavily involved in this.
It's a fine training to build something yourself,don't need a Raspberry Pi can take data from a API eg OpenWeatherMap API
Then use eg Flask and a weather widget, Weather app as help with HTML/CSS setup.
I have a tutorial here using Flask and OpenWeatherMap API.
Web-development(Flask, Django, FastAPI) is what i would use for this as usually get a better and more modern look than GUI can give.
I was helping someone servals years ago with a weather setup in Tkinter,it came out looking somewhat ok.
Posts: 232
Threads: 81
Joined: Nov 2021
Thanks for all the great advice!
I'm defiantly going to stick with a retro look for my G.U.I (because I want a retro-futuristic feel to my project) But it's good to know that there's a lot of software that can help me develop the G.U.I.
I'm looking into Tkinter and html/Css to help me create the GUI, but I'lll definaly check out Flask, Django and FastAPI.
A little side question:
I was playing around with tkinter and I noticed that I couldn't get it quite to full screen (and by full screen I meant I couldn't get rid of the top bar with the "x" & minimize and maximize button).
Will tkinter allow me to get rid of that top bar(I find it annoying and I can't stop focusing on it. I feel like it's going to take away from the GUI)?
Posts: 379
Threads: 2
Joined: Jan 2021
(Jan-31-2022, 10:21 PM)Extra Wrote: Will tkinter allow me to get rid of that top bar(I find it annoying and I can't stop focusing on it. I feel like it's going to take away from the GUI)? This goes full screen on my system.
"""
Code illustration: 8.01
Screensaver
Tkinter GUI Application Development Blueprints
"""
from tkinter import Tk, Canvas, BOTH
from random import randint
class RandomBall:
def __init__(self, canvas):
self.canvas = canvas
self.screen_width = canvas.winfo_screenwidth()
self.screen_height = canvas.winfo_screenheight()
self.create_ball()
def create_ball(self):
self.generate_random_attributes()
self.create_oval()
def generate_random_attributes(self):
self.radius = r = randint(40, 70)
self.x_coordinate = randint(r, self.screen_width - r)
self.y_coordinate = randint(r, self.screen_height - r)
self.x_velocity = randint(6, 12)
self.y_velocity = randint(6, 12)
self.color = self.generate_random_color()
def generate_random_color(self):
r = lambda: randint(0, 0xffff)
return '#{:04x}{:04x}{:04x}'.format(r(), r(), r())
def create_oval(self):
x1 = self.x_coordinate - self.radius
y1 = self.y_coordinate - self.radius
x2 = self.x_coordinate + self.radius
y2 = self.y_coordinate + self.radius
self.ball = self.canvas.create_oval(
x1, y1, x2, y2, fill=self.color, outline=self.color)
def move_ball(self):
self.check_screen_bounds()
self.x_coordinate += self.x_velocity
self.y_coordinate += self.y_velocity
self.canvas.move(self.ball, self.x_velocity, self.y_velocity)
def check_screen_bounds(self):
r = self.radius
if not r < self.y_coordinate < self.screen_height - r:
self.y_velocity = -self.y_velocity
if not r < self.x_coordinate < self.screen_width - r:
self.x_velocity = -self.x_velocity
class ScreenSaver:
balls = []
def __init__(self, number_of_balls):
self.root = Tk()
self.number_of_balls = number_of_balls
self.root.attributes('-fullscreen', True)
self.root.attributes('-alpha', 0.1)
self.root.wm_attributes('-alpha',0.1)
self.quit_on_interaction()
self.create_screensaver()
self.root.mainloop()
def create_screensaver(self):
self.create_canvas()
self.add_balls_to_canvas()
self.animate_balls()
def create_canvas(self):
self.canvas = Canvas(self.root)
self.canvas.pack(expand=1, fill=BOTH)
def add_balls_to_canvas(self):
for i in range(self.number_of_balls):
self.balls.append(RandomBall(self.canvas))
def quit_on_interaction(self):
for seq in ('<Any-KeyPress>', '<Any-Button>', '<Motion>'):
self.root.bind(seq, self.quit_screensaver)
def animate_balls(self):
for ball in self.balls:
ball.move_ball()
self.root.after(30, self.animate_balls)
def quit_screensaver(self, event):
self.root.destroy()
if __name__ == "__main__":
ScreenSaver(number_of_balls=18)
|