'Why aren't the elements or the background color showing on my Tkinter Toplevel window?
I need to get the "encryption_window" in the code shown to show the colored background and the elements added to it. I open a home window and then click on the "Encrypt" button, but no matter what I do, it always shows a blank, white screen! I have tried everything but I still can't find a solution! I will take any help I can get, so don't hesitate to add in a solution! Can someone show me how to fix this problem, please? Thanks in advance! (PS: The code is in Python!)
from tkinter import *
from simplecrypt import encrypt, decrypt
from tkinter import filedialog
from tkinter import messagebox
import os
master_window=Tk()
def goToHome():
global home_window
global encryption_window
global decryption_window
encryption_window.withdraw()
encryption_window.grab_release()
decryption_window.withdraw()
decryption_window.grab_release()
home_window.deiconify()
home_window.grab_set()
def goToEncryptionWindow():
global home_window
global encryption_window
home_window.withdraw()
home_window.grab_release()
encryption_window.deiconify()
encryption_window.grab_release()
def goToDecryptionWindow():
global home_window
global decryption_window
home_window.withdraw()
home_window.grab_release()
decryption_window.deiconify()
decryption_window.grab_release()
home_window=Toplevel(master_window)
home_window.title('Okoye File Crypter - Home')
home_window.wm_geometry('800x800')
home_window.resizable(False, False)
home_window.config(bg='#88b3a1')
home_window.grab_set()
main_label=Label(home_window, text='Okoye File Crypter', font=('Arial', 20, 'bold', 'italic'))
encrypt_file_button=Button(home_window, text='Encrypt File', bg='#d6e80e', command=goToEncryptionWindow)
decrypt_file_button=Button(home_window, text='Decrypt File', bg='#d6e80e', command=goToDecryptionWindow)
main_label.place(relx=0.5, rely=0.2, anchor=CENTER)
encrypt_file_button.place(relx=0.3, rely=0.5, anchor=CENTER)
decrypt_file_button.place(relx=0.7, rely=0.5, anchor=CENTER)
encryption_window=Toplevel(master_window)
encryption_window.title('Okoye File Crypter - Encryption')
encryption_window.wm_geometry('800x800')
encryption_window.resizable(False, False)
encryption_window.config(bg='#88b3a1')
encryption_window.withdraw()
info_label=Label(encryption_window, text='File Name:')
file_name_entry=Entry(encryption_window)
create_file_button=Button(encryption_window, text='Create File', bg='#d6e80e')
home_button=Button(encryption_window, text='Home', bg='#d6e80e', command=goToHome)
file_textfield=Text(encryption_window, width=500, height=500)
info_label.place(relx=0.2, rely=0.2, anchor=CENTER)
file_name_entry.place(relx=0.4, rely=0.2, anchor=CENTER)
create_file_button.place(relx=0.6, rely=0.2, anchor=CENTER)
home_button.place(relx=0.8, rely=0.2, anchor=CENTER)
file_textfield.place(relx=0.5, rely=0.5, anchor=CENTER)
decryption_window=Toplevel(master_window)
decryption_window.title('Okoye File Crypter - Decryption')
decryption_window.wm_geometry('800x800')
decryption_window.resizable(False, False)
decryption_window.config(bg='#88b3a1')
decryption_window.withdraw()
home_window.grab_set()
master_window.withdraw()
master_window.mainloop()
Solution 1:[1]
The reason the window is blank is because the extremely large textfield is blocking the elements. I didn't realize this at first, which is why I am answering my own question. -WillTechX20
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | WillTechX20 |
