labeling issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

labeling issue

Nathan Smith

So with the deprication of python 2 creeping ever closer, I finally,
(later than nearly the whole world), decided to convert over to python
3, and Wx Python phoenix.

First, love the imagery, phoenix=reborn, wx python reborn.

But I do have one problem, that may be slightly difficult to explain,
but I'll do my best

First, here is an example of some code:

class Mywin(wx.Frame):
  def __init__(self, parent, title):
   super(Mywin, self).__init__(parent, title = title,size = (350,250))

   # sets up some other screens too

  def setup_file_screen(self):
   panel = wx.Panel(self, wx.ID_ANY, style= wx.WANTS_CHARS)
   panel.SetBackgroundColour("white") # aparrently black on white is
easier to read, and labels in wx are black anyway so...
   vbox = wx.BoxSizer(wx.VERTICAL)
   hbox1 = wx.BoxSizer(wx.HORIZONTAL)
   l3 = wx.StaticText(panel, -1, "Screen Selection.")
   hbox1.Add(l3, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   self.info1 = wx.ListCtrl(panel, -1, style = wx.LC_REPORT)  # pairs
with l3
   hbox1.Add(self.info1, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   self.info1.InsertColumn(0, "Screen Selection.")
   for x in range(len(g.screens)): # draws from a variable of screen names
    self.info1.InsertItem(x, g.screens[x])
   self.info1.Bind(wx.EVT_LIST_ITEM_SELECTED, self.changescreen) # so
that it can chang screens when necessary
   l1 = wx.StaticText(panel, -1, "Folders and files.")  # links with
self.files below
   hbox1.Add(l1, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   self.files = wx.ListCtrl(panel, -1, style = wx.LC_REPORT)
   self.files.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
   self.files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.handle_move_file) #
not really relevant to my problem but included anyway
   self.files.Bind(wx.EVT_LIST_ITEM_SELECTED, self.fileinfo) # see above

   hbox1.Add(self.files, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   l2 = wx.StaticText(panel, -1, "Item information.")  # links to
   hbox1.Add(l2, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) = wx.ListCtrl(panel, -1, style = wx.LC_REPORT)
   hbox1.Add(, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)
   self.handle_keyboard("files") # for keyboard shortcuts.
   browse1 = wx.Button(panel, -1, "Exit!")
   browse1.Bind(wx.EVT_BUTTON, self.endit)

  # other important code:

def changescreen(self, event):

   if(which==g.which): # g is a place for global variables, not really

  # calls here that hide each panel, like self.filepanel.Hide()



Then, when I launch the program, it does this:


  cl=Mywin(None,  "My program.")

  cl.changescreen(fake_event("Files.")) # fake event is a class that
just creates a fake object with a GetText method, probably lazy but
there you are

Now that the code is there, here's my problem:

In wx classic, I would create this, and when ever I tabbed into a list
CTRL it would read the name of that List CTRL to me, such as "files and
folders." Now, however, it just says List CTRL.

Further, when I alt tab into the window, it just says, "frame" when
previously it said nothing.

Why is this exactly?

I realise screen readers are a blindy thing, but perhaps wondered if one
of you guys would be able to spot where I'm missing a label, or not
linking the listctrl and labels together?

I always thought the way classic managed to link the two together was
pretty smart, but now also realise what I call "linking together" may
have just been a trick of some kind being done in the background.

I'd also be interested in any feedback you guys have regarding my code.
Being self taught, I realise there can be some pretty massive errors I
miss in terms of technique and redundancies.

Thanks so muchh,


You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit