Мой фрейм Tkinter располагается неправильно

Я пишу интерфейс управления системы "умного дома" собственной разработки на базе Arduino, Python и Tkinter. Код предоставлен ниже. Фрейм container_s1 располагается не так, как нужно (фрейм неверно интерпретирует параметры padx и pady — его верхняя граница находится ниже, чем нужно: очень большой излишний отступ).

Код интерфейса:


    from tkinter import *
    from tkinter.font import *
    from tkinter.messagebox import showinfo, showerror
    from _asQamm.execute import *
    from serial import *
    from pyduino import *
    
    
    selectionFrame = int(1)
    
    
    def hex(rgb):   
        return "#%02x%02x%02x" % rgb
    
    
    def reselection(button):
        global selectionFrame
    
        selectionFrame = button
    
    
    class _rootWindow_:
    
        root = Tk()
        root.iconbitmap('icon.ico')
        root.title('AsQamm Dekstop (pre-α)')
        root.resizable(0, 0)
        root.geometry('1000x440+10+20')
        root.configure(bg = 'snow')
    
    
    #mainWindow declaration:
    
        leftMenuFrame = Frame(bg = hex((71, 122, 37)), pady = 10)
        leftMenuFrame.grid(row = 0, column = 0, rowspan = 15)
    
        leftMenuFrame_Button1 = Button(leftMenuFrame, background = hex((42, 105, 23)), text = 'Дом', fg = hex((255, 255, 255)),
                                       activebackground = hex((47, 94, 25)), activeforeground = hex((255, 255, 255)),
                                       relief = FLAT, overrelief = GROOVE, pady = 25, padx = 10, command = reselection(1))
        leftMenuFrame_Button1.grid(row = 0, column = 0, rowspan = 3, padx = 12, pady = 5, sticky = N+S+E+W)
    
        leftMenuFrame_Button2 = Button(leftMenuFrame, background = hex((42, 105, 23)), text = 'Защита', fg = hex((255, 255, 255)),
                                       activebackground = hex((47, 94, 25)), activeforeground = hex((255, 255, 255)),
                                       relief = FLAT, overrelief = GROOVE, pady = 25, padx = 10, command = reselection(2))
        leftMenuFrame_Button2.grid(row = 3, column = 0, rowspan = 3, padx = 12, pady = 5, sticky = N+S+E+W)
    
        leftMenuFrame_Button3 = Button(leftMenuFrame, background = hex((42, 105, 23)), text = 'Растения', fg = hex((255, 255, 255)),
                                       activebackground = hex((47, 94, 25)), activeforeground = hex((255, 255, 255)),
                                       relief = FLAT, overrelief = GROOVE, pady = 25, padx = 10, command = reselection(3))
        leftMenuFrame_Button3.grid(row = 6, column = 0, rowspan = 3, padx = 12, pady = 5, sticky = N+S+E+W)
    
        leftMenuFrame_Button4 = Button(leftMenuFrame, background = hex((42, 105, 23)), text = 'Управление', fg = hex((255, 255, 255)),
                                       activebackground = hex((47, 94, 25)), activeforeground = hex((255, 255, 255)),
                                       relief = FLAT, overrelief = GROOVE, pady = 25, padx = 10, command = reselection(4))
        leftMenuFrame_Button4.grid(row = 9, column = 0, rowspan = 3, padx = 12, pady = 5, sticky = N+S+E+W)
    
        leftMenuFrame_Button5 = Button(leftMenuFrame, background = hex((42, 105, 23)), text = 'Конфигурация', fg = hex((255, 255, 255)),
                                       activebackground = hex((47, 94, 25)), activeforeground = hex((255, 255, 255)),
                                       relief = FLAT, overrelief = GROOVE, pady = 25, padx = 10, command = reselection(5))
        leftMenuFrame_Button5.grid(row = 12, column = 0, rowspan = 3, padx = 12, pady = 5, sticky = N+S+E+W)
    
        upperFrame = Frame(root, bg = 'snow', padx = 12, pady = 15)
        upperFrame.grid(row = 0, column = 1, columnspan = 10, sticky = N+E+S)
    
        upperFrame_buttonSave = Button(upperFrame, text = 'Сохранить настройки', relief = GROOVE, padx = 55, pady = 5,
                                      bg = hex((222, 222, 222)), overrelief = FLAT)
        upperFrame_buttonSave.grid(row = 0, column = 1, columnspan = 3)
    
        upperFrame_buttonRefresh = Button(upperFrame, text = 'Применить настройки', relief = GROOVE, padx = 55, pady = 5,
                                      bg = hex((222, 222, 222)), overrelief = FLAT)
        upperFrame_buttonRefresh.grid(row = 0, column = 4, columnspan = 3)
    
        upperFrame_buttonLoad = Button(upperFrame, text = 'Загрузить настройки', relief = GROOVE, padx = 55, pady = 5,
                                      bg = hex((222, 222, 222)), overrelief = FLAT)
        upperFrame_buttonLoad.grid(row = 0, column = 7, columnspan = 3)
    
    
    class _mainContainer_:
        def __init__(self, __root__):
            self.root = __root__
    
            container_s1 = Frame(self.root, bg = hex((255, 0, 0)))
            container_s1.grid(row = 1, column = 1, rowspan = 15, columnspan = 10, sticky = N+S+E+W)


Ответы (0 шт):