Не отрисовывается Canvas в дочернем окне, что делать?
from tkinter import *
from tkinter import messagebox
from PIL import ImageTk
from tkinter import ttk
import settings
# Основное окно
root = Tk()
root.title("Рандомайзер") # Название окна
root.geometry("800x500+150+200") # Размер окна
root.iconbitmap(settings.ICON) # Иконка окна
root.resizable(width=False, height=False) # Неизменяемость размера окна
C = Canvas(bg="blue", height=250, width=300)
filename = PhotoImage(file=settings.BACKGROUND) # Фон окна
background_label = Label(image=filename)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
fg = '#f0e6e8' # Мягкий белый цвет
bg = '#BA112C' # Цвет фона
# Окно настроек
def create_window():
second_window = Toplevel()
second_window.title("Настройки")
second_window.geometry("400x250+200+400") # Размер окна
second_window.iconbitmap(settings.ICON_SETTINGS) # Иконка окна
second_window.resizable(width=False, height=False) # Неизменяемость размера окна
bg_settings_window = settings.BACKGROUND2
C = Canvas(bg="blue", height=250, width=300)
photo = PhotoImage(file=bg_settings_window) # Фон окна
bl = Label(image=photo)
bl.place(x=0, y=0, relwidth=1, relheight=1)
# Button, Entry, Labels (window_settings)
style = ttk.Style()
style.configure("TRadiobutton", background="#BA112C", foreground='white')
ttk.Radiobutton(second_window, value=1, style="TRadiobutton").pack()
second_window.mainloop()
# Logic window 1
# Button, Label, Entry
# Все картинки
images = {
'btn_generate': PhotoImage(file=settings.BTN_GENERATE),
'btn_icon': PhotoImage(file=settings.BTN_ICON_SETTINGS),
}
style = ttk.Style()
style.configure("TRadiobutton", background=bg, foreground='white')
style.configure("TButton", background=bg, foreground="#BA112C", font="HelveticaNeueCyr 17 bold", image=images['btn_generate'])
main_entry = ttk.Entry(root, width=60, font="Arial 10 bold")
main_entry.place(x=190, y=150, height=55)
ttk.Radiobutton(root, text="Выбрать из списка", value=1, style="TRadiobutton").place(x=30, y=440)
ttk.Radiobutton(root, text="Случайное число", value=2, style="TRadiobutton").place(x=200, y=440)
ttk.Radiobutton(root, text="Случайный пароль", value=3, style="TRadiobutton").place(x=200, y=390)
ttk.Radiobutton(root, text="Перемешать слова", value=4, style="TRadiobutton").place(x=30, y=390)
ttk.Button(root, text="Сгенерировать", style="TButton").place(x=283, y=235)
Button(root, image=images['btn_icon'], background=bg, command=create_window).place(x=730, y=15)
root.mainloop()`введите сюда код`