37 lines
1014 B
Python
Executable File
37 lines
1014 B
Python
Executable File
import tkinter as tk
|
|
from PIL import Image, ImageTk
|
|
from tkinter import ttk
|
|
|
|
root = tk.Tk()
|
|
root.title("Tkinter Window Demo")
|
|
#root.geometry("600x480+50+50")
|
|
my_font=("Diablo",14)
|
|
root.configure(bg="#000000")
|
|
tk.Button(root, text="Classic Label").pack()#wenn dann den
|
|
ttk.Button(root, text="Themed Label").pack()
|
|
|
|
img_original = Image.open("Glados.png")
|
|
|
|
img_resized = img_original.resize((64,64),Image.Resampling.LANCZOS)
|
|
|
|
icon_img = ImageTk.PhotoImage(img_resized)
|
|
|
|
root.iconphoto(False, icon_img)
|
|
|
|
window_width = 800
|
|
window_height = 600
|
|
|
|
screen_width = root.winfo_screenwidth()
|
|
screen_height = root.winfo_screenheight()
|
|
|
|
center_x = int(screen_width/2 - window_width/2)
|
|
center_y = int(screen_height/2 - window_height/2)
|
|
|
|
root.geometry(f"{window_width}x{window_height}+{center_x}+{center_y}")
|
|
root.resizable(False,False)
|
|
#root.attributes("-alpha",0.5)
|
|
|
|
message = tk.Label(root, text="Hello World!",bg="#000000",fg="#ffffff",font=my_font).pack()
|
|
#message.pack()
|
|
|
|
root.mainloop() |