How can I make the background of Label in customtkinter transparent?

  Kiến thức lập trình

I create a small app on Python using customtkinter, I have a widget Textbox, in should be Lable, which will not overlap the text in Textbox.
Code:
from customtkinter import *

    class App(CTk):
def __init__(self):
    self.app = CTk()
    self.app.geometry('500x400')
    self.app.resizable(width=False, height=False)
    self.app.title('window')


    self.frame1 = CTkFrame(master=self.app, fg_color='#2b5a5c', corner_radius= 10)
    self.frame1.pack(side="top", fill="both", expand=True, padx=20, pady=10)

    #widget - input Textbox with Label
    self.txbox = CTkTextbox(master=self.frame1, width=300, height=90, corner_radius=9, border_width=2, scrollbar_button_color='#fccc8c', scrollbar_button_hover_color='#deb773', border_color='#fccc8c', bg_color=self.frame1._fg_color)
    self.txbox.place(anchor = CENTER, relx = 0.5, rely = 0.35)
    self.lbtxbox = CTkLabel(master=self.txbox, text='message', bg_color="transparent", text_color='#7d7d7d')
    self.lbtxbox.place(anchor=CENTER, relx=0.5, rely=0.3)


    self.app.mainloop()
if __name__ == '__main__':
    App()

I tried assigning bg_color=’transparent’ does not help, is it possible to make the background of Label transparent?

New contributor

Kefuch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT