Transparent text widget in python and tkinter like glass notepad
Asked
Active
Viewed 5,539 times
1 Answers
3
For windows, you can create a Text
widget, specify the background colour, and then use wm_attributes
to set that colour transparent.
import tkinter as tk
root = tk.Tk()
text = tk.Text(root,bg="white")
text.insert(tk.END,"This is a test message")
text.pack()
text.configure(font=("Times New Roman", 12, "bold"))
root.wm_attributes("-transparentcolor", "white")
root.mainloop()

Henry Yik
- 22,275
- 4
- 18
- 40
-
Could u answer by one more question? – Shubham Jul 08 '19 at 07:45
-
How to create a GUI designer in python and tkinter? – Shubham Jul 08 '19 at 07:45
-
Is that windows only @HenryYik ? – Reblochon Masque Jul 08 '19 at 07:53
-
@Shubham That question is too broad to answer. If you came across a specific part where you got stuck, you can post a question and people will help. – Henry Yik Jul 08 '19 at 07:54
-
@ReblochonMasque according to [this post](https://stackoverflow.com/questions/19080499/transparent-background-in-a-tkinter-window/19094652#19094652), there is no cross platform way to ensure background transparency, although I have not tested the above on MacOS or Linux. – Henry Yik Jul 08 '19 at 07:58