Jun-28-2024, 08:05 PM
under is the actual script, I'm still on the learning side. I have done others before this particular one and they all executed and popped up the GUI. This one hasn't been able to run and only shows "Process finished with exit code 0".
it's on PyCharm Community Edition 2024.1.4, Python 3.12.
it's on PyCharm Community Edition 2024.1.4, Python 3.12.
import tkinter as tk class MyGUI: def __int__(self): self.root = tk.Tk() self.label = tk.Label(text='My message', font=('Arial', 18)) self.label.pack(padx=10, pady=10) self.textbox = tk.Text(height=3) self.textbox.pack(padx=10, pady=10) self.check_state = tk.IntVar() self.check = tk.Checkbutton(text='State check', font=('Arial', 16), variable=self.check_state) self.check.pack(padx=10, pady=10) self.button = tk.Button(text='Show message', font=('Arial', 18), command=self.message) self.button.pack(padx=10, pady=10) self.root.mainloop() def message(self): print(self.check_state.get()) MyGUI()
Output:Process finished with exit code 0