Bisher habe ich das Text-Widget, aber der Hintergrund ist nicht transparent .
Wenn ich
verwende
Code: Select all
root.wm_attributes("-alpha", 0.5)
Wie lasse ich den Text erscheinen, aber ohne Hintergrund?
Hier ist mein Code
Code: Select all
from tkinter import *
def center_window(window):
window.update_idletasks()
width = window.winfo_width()
height = window.winfo_height()
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
x = (screen_width - width) // 2
y = (screen_height - height) // 2
window.geometry(f"{width}x{height}+{x}+{y}")
canvas.create_text(100, 100, text="+", fill="red", font=("Purisa", 20, ""))
canvas.pack()
root.wait_visibility(root)
root.attributes("-alpha", 0.5)
root=Tk()
canvas = Canvas()
center_window(root)
root.mainloop()