Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kako da widgeti budu jedan pored drugog?

[es] :: Python :: Kako da widgeti budu jedan pored drugog?

[ Pregleda: 7591 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

wraith46

Član broj: 336363
Poruke: 29



+1 Profil

icon Kako da widgeti budu jedan pored drugog?31.03.2017. u 19:25 - pre 86 meseci
Pravim jednostavan GUI program, imam problem sa widgetima. Logično mi je da ako hoću da tri buttona (Add, Remove, Edit) budu jedan pored drugog, stavim:

column = 0, za Add
column = 1, za Remove
column = 2, za Edit

Međutim, pogledajte kako ih poređa.



Kako da to rešim? Zar ne postoji opcija da se widgeti place-uju npr height = 30, width = 30?

Evo šta sam uradio:

Code:
    def createWidgets(self):

        listBox = Listbox().grid(row=1)

        buttonAdd = Button(self.root,
                           text = "Add",
                           command = self.addItem).grid(row = 2, column = 0, sticky = W)

        buttonRemove = Button(self.root,
                              text="Remove",
                              command = self.removeItem).grid(row = 2, column = 1, sticky = W)


        buttonEdit = Button(self.root,
                            text="Edit",
                            command = self.editItem).grid(row = 2, column = 2, sticky = W) 


 
Odgovor na temu

wraith46

Član broj: 336363
Poruke: 29



+1 Profil

icon Re: Kako da widgeti budu jedan pored drugog?01.04.2017. u 09:44 - pre 85 meseci
Rešenje:

Code:
    def createWidgets(self):

        Button(self.root,
               text = "Add",
               command = self.addItem).grid(row = 2, column = 0, sticky = W + E)

        Button(self.root,
               text="Remove",
               command = self.removeItem).grid(row = 2, column = 1, sticky = W + E)

        Button(self.root,
               text="Edit",
               command = self.editItem).grid(row = 2, column = 2, sticky = W + E)

        listBox = Listbox(width = 30).grid(row = 1, sticky = W + E, columnspan = 3)

        textBox = Text(height=5, width=30).grid(row = 3, columnspan = 3, sticky = W + E + N + S)
 
Odgovor na temu

[es] :: Python :: Kako da widgeti budu jedan pored drugog?

[ Pregleda: 7591 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.