Problem with text alignment

Discussion in 'Python' started by alejandro, Mar 4, 2009.

  1. alejandro

    alejandro Guest

    I can't align the text on the right in my wxDialog.
    Everything else works fine


    self.sirina = wx.StaticText(self,-1,'',(200,50),style=wx.ALIGN_RIGHT)
    alejandro, Mar 4, 2009
    #1
    1. Advertising

  2. alejandro

    alejandro Guest

    Here is the whole dialog:

    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"))
    #-------------------------- 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
    wx.StaticText(self,-1,'Sirina role',(20,50))
    wx.StaticText(self,-1,'Naziv folije',(20,80))
    wx.StaticText(self,-1,'Cijena po duznom metru',(20,110))
    #--------------------------text izmjenjivi
    self.sirina =
    wx.StaticText(self,-1,'',(200,50),style=wx.ALIGN_RIGHT)
    self.ime = wx.StaticText(self,-1,'',(200,80),style=wx.ALIGN_RIGHT)
    self.cina = wx.StaticText(self,-1,'',(200,110),style=wx.ALIGN_RIGHT)

    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]))
    alejandro, Mar 4, 2009
    #2
    1. Advertising

  3. En Wed, 04 Mar 2009 06:14:41 -0200, alejandro
    <> escribió:

    > I can't align the text on the right in my wxDialog.
    > Everything else works fine
    >
    >
    > self.sirina = wx.StaticText(self,-1,'',(200,50),style=wx.ALIGN_RIGHT)


    In case there is a misunderstanding, ALIGN_RIGHT means that the text
    itself is right aligned inside the widget, not that the widget is placed
    against the right border of its container.

    --
    Gabriel Genellina
    Gabriel Genellina, Mar 4, 2009
    #3
  4. alejandro

    alejandro Guest


    >> self.sirina = wx.StaticText(self,-1,'Some text that\n will be alignet
    >> \nat the right',(200,50),style=wx.ALIGN_RIGHT)

    #----------------- this would be an example, the reason I didnt understand
    is that I used just one line of text





    I understand now. Can I align it on the right withot using sizers?
    alejandro, Mar 4, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad

    Checkbox text alignment

    tshad, Mar 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    516
    tshad
    Mar 7, 2005
  2. =?Utf-8?B?QmFobWFu?=

    Checkbox Text Alignment

    =?Utf-8?B?QmFobWFu?=, Feb 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,587
    =?Utf-8?B?QmFobWFu?=
    Feb 9, 2006
  3. FluxForums

    Text Alignment

    FluxForums, Feb 22, 2004, in forum: HTML
    Replies:
    29
    Views:
    964
    SpaceGirl
    Feb 23, 2004
  4. Karsten Wutzke

    Text field text alignment

    Karsten Wutzke, Dec 14, 2006, in forum: HTML
    Replies:
    5
    Views:
    839
    Jonathan N. Little
    Dec 14, 2006
  5. Mtmartin71
    Replies:
    9
    Views:
    806
    Adrienne Boswell
    Aug 28, 2007
Loading...

Share This Page