[ wraith46 @ 31.03.2017. 19:25 ] @
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) 


[ wraith46 @ 01.04.2017. 09:44 ] @
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)