Python Forum
GUI on Raspberry pi 3 model
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI on Raspberry pi 3 model
#1
Hello, I need some help!
I have a raspberry pi 3 model, with the raspbian OS installed, and i'm trying to make GUI menu with some buttons, and when i click it will start applications installed on the raspbian, like Kodi, Libre Office and others or a page browser.
Can anyone help me?? How I make the GUI??
Thanks
Reply
#2
I'm only learning myself so my code won't be the best. I have found tkinter to be the easiest to understand so here is a little example.
#!/usr/bin/env python3
from tkinter import *
from tkinter import messagebox
root=Tk()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
TF = ("Helvetica", 28, "bold") 
TFS = ("Helvetica", 16, "bold")
TF2 = ("Helvetica", 28, "bold")

def helpme():
  messagebox.showinfo("Information", "This is just a test message. \nPut whatever you want in it.\nYou need to check it's output and respond as you wish.")
frame0 = Frame(root, width=screen_width, height=screen_height) 
frame0.grid(row=0,column=0)
button1 = Button(frame0,text = "Help", font = TF, command = lambda: helpme())
button1.grid(row = 0, column = 0)
button2 = Button(frame0,text = "Exit", font = TF, command = lambda: quit())
button2.grid(row = 0, column = 1)
root.wm_title("Put your title here")
root.mainloop()
Play around with some of the values to see what happens. If you make a backup copy first and you mess up just copy it and start again.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020