0

I try to set à simple text with Tkinter on my back ground but the white box is a little trash. I try solution that I found (wm.attributs("-transparentcolor", "randomcolor") but all do disappear the canva background but also my global background.

from tkinter import *


root = Tk()
root.geometry("600x300")
root.resizable(False, False)
root.title('Aveugle EDT')


class Button():
    def Button_format(self, position_X, position_Y):
        self.format = Frame(root)
        self.format.place(x=position_X, y=position_Y)
        self.Text_written = StringVar()

    def Button_visual(self, font_color, text_color, border_size, font_text):    
        self.Variable_texte = Entry(self.format, textvariable = self.Text_written, 
                                    background = font_color, bd = border_size, 
                                    fg = text_color, font = font_text)
        self.Variable_texte.pack(fill='x', expand=True)
        self.Variable_texte.focus()
        
    def Window_visual(self, FD_image):
        self.Background_image = PhotoImage(file = FD_image)
        self.background_label = Label(root, image = self.Background_image)
        self.background_label.place(x=0, y=0, relwidth=1, relheight=1)
        
    def Text_name(self):
        self.canvas = Canvas(root, width=40, height=16)
        self.canvas.create_text(20, 10, text = "Test", font=('Helvetica 10 bold'))
        self.canvas.place(x=10, y= 1)
    

Bouton_test = Button()


Bouton_test.Window_visual(FD_image = "FD.png")

Bouton_test.Button_format(position_X = 10, position_Y = 23)
Bouton_test.Button_visual("#F9F8ED", "black", 3, "Georgia")
Bouton_test.Text_name()

root.mainloop()

Using the wm.attributs of tkinter but doesnt work proprety

and when I use canvas he don't use all the image like this[Screen of test whit canvas (image = 1000x1000, root = 600x300]

Wida
  • 1
  • 1
  • Does this answer your question? [Transparent background in a Tkinter window](https://stackoverflow.com/questions/19080499/transparent-background-in-a-tkinter-window) – relent95 Apr 16 '23 at 10:33

0 Answers0