WX Not Reading the First Dialog Label

I have the following class, taken from a Python wx tutorial found here:

class EditDialog(wx.Dialog):
    def __init__(self, mp3):
        #...
        self.artist = wx.TextCtrl(self, value=self.mp3.tag.artist)
        self.add_widgets('Artist', self.artist)
        self.album = wx.TextCtrl(self, value=self.mp3.tag.album)
        self.add_widgets('Album', self.album)
        self.title = wx.TextCtrl(self, value=self.mp3.tag.title)
        self.add_widgets('Title', self.title)

The code for add_widgets method looks like this:

    def add_widgets(self, label_text, text_ctrl):
        row_sizer = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, label=label_text, size=(50, -1))
        row_sizer.Add(label, 0, wx.ALL, 5)
        row_sizer.Add(text_ctrl, 1, wx.ALL | wx.EXPAND, 5)
        self.main_sizer.Add(row_sizer, 0, wx.EXPAND)

Running the full application produces the expected result, but the title field never gets read. I.e, tabbing over announces "Album", "Artist", but the title label never gets picked up. Does anybody know how to fix this?
Also, why does it all look backwards? I.e, in the code, artist gets added first, but the title field appears first within the application. Perhaps this is the issue?



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Reply via email to