wxPython text alignment again

alejandro aleksandar27 at brisiovonet.hr
Sun Mar 8 01:30:10 CET 2009


I managed to align the text to the right but when I change it with a 
function it gets messy....
What is wrong now?


class OpcijeFolija(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self,parent, id, title, size=(300,300))
        foli=cPickle.load(file("folije.data"))
        sizer = wx.GridBagSizer(5, 9)
        #-------------------------- dropdown

        self.combo = wx.ComboBox(self, 10, pos=(20,20), size=(150,-1), 
choices=foli,style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, self.OnSelect, id=10)

        #--------------------------text
        sizer.Add(wx.StaticText(self,-1,'Sirina role'),(2,1),(1,1))
        sizer.Add(wx.StaticText(self,-1,'Naziv folije'),(3,1),(1,1))
        sizer.Add(wx.StaticText(self,-1,'Cijena po duznom 
metru'),(4,1),(1,1))
        #--------------------------text izmjenjivi
        self.sirina = wx.StaticText(self,-1,'something')
        sizer.Add((self.sirina),(2,4),(1,1),wx.ALIGN_RIGHT)
        self.ime = wx.StaticText(self,-1,'someth')
        sizer.Add((self.ime),(3,4),(1,1),wx.ALIGN_RIGHT)
        self.cina = wx.StaticText(self,-1,'som')
        sizer.Add((self.cina),(4,4),(1,1),wx.ALIGN_RIGHT)
        self.SetSizer(sizer)
        #self.Centre()

        #-------------------------- botuni
        wx.Button(self,1,'Novi unos',(20,200), size=(80,20))
        wx.Button(self, 2,'Izbrisi',(110,200), size=(80,20))
        wx.Button(self, 3, 'Zatvori',(200,200),size=(80,20))
        self.Bind(wx.EVT_BUTTON, self.OnClose, id=3)

    def OnClose(self, event):
        self.Close()

    def OnSelect(self, event):
        redBr = self.combo.GetCurrentSelection()
        sirinaFajl = cPickle.load(file("sirina.data"))
        imeFajl = cPickle.load(file("folije.data"))
        cijenaDuzinaFajl = cPickle.load(file("duzina.data"))

        self.sirina.SetLabel(str(sirinaFajl[redBr]))
        self.ime.SetLabel(str(imeFajl[redBr]))
        self.cina.SetLabel(str(cijenaDuzinaFajl[redBr])) 





More information about the Python-list mailing list