Jan-25-2022, 04:49 PM
Hello Qwertz, here is your required gui code. I am also beginner to tkinter and gui creation but with the help of google this is what I made. Hope it works fine for you.
# importing the required libraries from tkinter import * from tkinter import ttk from tkinter import messagebox # creating an instance of tkinter window win = Tk() # set geometry of your frame win.geometry('550x300') # your function to get values from user in tkinter widget def enterNumber(): try: hours = int(float(entry.get())) minutes = int(((float(entry.get()) * 60) % 60)) except: messagebox.showerror('Error', 'Not a number.') Label(win, text = ('%s hours and %s minutes.')%(hours, minutes), font=('Century 16')).pack(pady = 20) # create an Entry widget entry = ttk.Entry(win, font = ('Century 12'), width = 40) entry.pack(pady = 30) # create a button to display the output button = ttk.Button(win, text = 'Enter', command = enterNumber) button.pack() win.mainloop() # enjou with peace