SimpleApp
user_6919294
python
a month ago
1.1 kB
17
Indexable
import tkinter as tk
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title("Prosty Tkinter")
self.geometry("300x150")
self.resizable(False, False)
self.configure(bg="#f0f0f0")
self._click_count = 0
self.label = tk.Label(
self,
text="Witaj w Tkinter!",
font=("Arial", 12),
bg="#f0f0f0",
fg="#333333",
)
self.label.pack(pady=15)
self.button = tk.Button(
self,
text="Kliknij mnie",
command=self._on_click,
width=15,
bg="#4a90d9",
fg="white",
activebackground="#357abd",
relief="flat",
cursor="hand2",
)
self.button.pack(pady=10)
def _on_click(self) -> None:
self._click_count += 1
self.label.config(
text=f"Kliknięto przycisk! ({self._click_count}×)"
)
if __name__ == "__main__":
app = App()
app.mainloop()Editor is loading...
Leave a Comment