Adapt different levels of grid so as not to affect the different components of the window

0

I have the following code to make a calendar selector, but the grid of the month change buttons make the calendar appear separate:

def setup(self, y, m):
    left = Button(self.parent, text='<', command=self.go_prev)
    self.wid.append(left)
    left.grid(row=0, column=0, columnspan=1)

    header = Label(self.parent, text='{}   {}'.format(getMesTexto(m), str(y)))
    self.wid.append(header)
    header.grid(row=0, column=2, columnspan=2)

    right = Button(self.parent, text='>', command=self.go_next)
    self.wid.append(right)
    right.grid(row=0, column=6, columnspan=1)

    days = ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado']
    for num, name in enumerate(days):
        t = Label(self.parent, text=name[:3])
        self.wid.append(t)
        t.grid(row=1, column=num, pady=20)

    for w, week in enumerate(self.cal.monthdayscalendar(y, m), 2):
        for d, day in enumerate(week):
            if day:
                #print(calendar.day_name[day])
                b = Button(self.parent, width=2, text=day, command=lambda day=day:self.selection(day, days[(day-1) % 7]))
                self.wid.append(b)
                b.grid(row=w, column=d)

    sel = Label(self.parent, text='{} {} {} {}'.format(
        self.day_name, self.day_selected, getMesTexto(self.month_selected), self.year_selected))
    self.wid.append(sel)
    sel.grid(row=9, column=0, columnspan=7, pady=20)

    ok = Button(self.parent, width=5, text='OK', command=self.kill_and_save)
    self.wid.append(ok)
    ok.grid(row=10, column=2, columnspan=3, pady=10)

Any solution?

    
asked by Adriana_0_0 06.08.2018 в 11:14
source

0 answers