无框文本

问题描述 投票:0回答:1

我可以修改什么以便在 PyCharm 创建的窗口上只显示文本而不显示框架?

enter image description here

label = customtkinter.CTkLabel(app, text="I want a text without a frame, and the frame reflects the wallpaper", font=('Century Gothic', 20))
label.place(x=50, y=50)

我尝试了这个代码,它不起作用!

# Set app background to transparent (this might not work as expected with customtkinter)
app.attributes("-transparentcolor", "grey");

# Creation of the label without visible frame
label = ctk.CTkLabel(app, text="I want a text without a frame, and the frame reflects the wallpaper", font=('Century Gothic', 20), fg="white", bg="grey");

label.place(x=50, y=50);

app.mainloop()

感谢您的帮助!

python user-interface pycharm
1个回答
0
投票
import tkinter as tk

# Create the tkinter window
app = tk.Tk()

# Make the window background transparent
app.attributes("-alpha", 0.0)  # Set transparency level to 0.0 for 
full transparency

# Creation of the label without visible frame
label = tk.Label(app, text="I want a text without a frame, and the 
frame reflects the wallpaper", font=('Century Gothic', 20), 
fg="white", bg="grey")
label.place(x=50, y=50)

# Run the tkinter event loop
app.mainloop()
© www.soinside.com 2019 - 2024. All rights reserved.