Tkinter Texboxes Becoming Transparent On A Button Click Tkinter Texboxes Becoming Transparent On A Button Click tkinter tkinter

Tkinter Texboxes Becoming Transparent On A Button Click


Try this:

from tkinter import Tk, scrolledtext, INSERT, Button, PhotoImage, Label, Textroot = Tk()root.geometry('1000x550')bg = PhotoImage(file='./assets/bg.png')root.resizable(False, False)root.title('Testing Classes')window = Label(root, image=bg)window.place(relheight=1, relwidth=1)tokenBox = Text(root, bd=0, height=1, width=30)def get_token():    token = tokenBox.get('1.0', 'end-1c')    print(token)    return tokenprefixBox = Text(root, bd=0, height=1, width=20)prefixBox.place(x=400, y=100)tokenBox.place(x=350, y=150)def get_prefix():    prefix = prefixBox.get('1.0', 'end-1c')    print(prefix)    return prefixdef codeInsert():    # Add these lines here if you want to remove the button/entries.    #tokenBox.place_forget()    #prefixBox.place_forget()    #submit.place_forget()    code = f'''    import discord    from discord.ext import commands    bot = commands.Bot(prefix={get_prefix()})    bot.run({get_token()})    '''    codeBox = scrolledtext.ScrolledText(root, width=50, height=15, bg='Black', fg='Red')    codeBox.insert(INSERT, code)    codeBox.configure(state='disabled')    codeBox.place(x=300, y=300)submit = Button(root, command=codeInsert, text='Submit Everything', bd=0)submit.place(x=425, y=250)window.mainloop()

The problem is that you had the label (named window) as the master for the other widgets. You should never have a tk.Label as a parent for anything. When I changed all their parents to root it worked.