user2957482
user2957482

Reputation: 56

Shows WxPython widgets on the Screen

Currently I'm trying make a GUI using Wx Python 2.9.5.0 and Python 2.7.3 under Windows Siete 32 Bits. I am a screen reader user, and for me, the screen reader reads the two controls that I specified in the code, but a friend says that in the screen, she can not see one of these controls.

It appears that when a screen reader is enabled, this software can read all widgets, but I am interested in show the widgets also on the screen.

Someone knows if exist a way to show all widgets on the screen?

Here are a fragment of the code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx
class main(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "Testing an app")
        self.Maximize()
        panel = wx.Panel(self, -1)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        listbox = wx.BoxSizer(wx.HORIZONTAL)
        textbox = wx.BoxSizer(wx.HORIZONTAL)
        textList = wx.StaticText(panel, -1, "Text1")
        self.listBox = wx.ListBox(self, -1, choices=["Some large text", "another large text"], size=(400, 400))
        text = wx.StaticText(panel, -1, "Content")
        self.text = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY|wx.TE_MULTILINE, size=(500, 500))
        listbox.Add(textList)
        listbox.Add(self.listBox)
        textbox.Add(text)
        textbox.Add(self.text)
        sizer.Add(listbox)
        sizer.Add(textbox)
        self.SetSizer(sizer)
  # Some stuff here...
if __name__ == "__main__":
    app = wx.App()
    frame = main().Show()
    app.MainLoop()

Upvotes: 0

Views: 187

Answers (1)

Yoriz
Yoriz

Reputation: 3625

You have the ListBox parented to the frame instead of the panel and setting the sizer on the frame and not the panel.

import wx

class main(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "Testing an app")
        self.Maximize()
        panel = wx.Panel(self, -1)
        textList = wx.StaticText(panel, -1, "Text1")
        self.listBox = wx.ListBox(panel, -1, choices=["Some large text", "another large text"], size=(400, 400))
        text = wx.StaticText(panel, -1, "Content")
        self.text = wx.TextCtrl(panel, -1, "", style=wx.TE_READONLY|wx.TE_MULTILINE, size=(500, 500))

        listbox = wx.BoxSizer(wx.HORIZONTAL)
        listbox.Add(textList)
        listbox.Add(self.listBox)

        textbox = wx.BoxSizer(wx.HORIZONTAL)
        textbox.Add(text)
        textbox.Add(self.text)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(listbox)
        sizer.Add(textbox)
        panel.SetSizer(sizer)
  # Some stuff here...
if __name__ == "__main__":
    app = wx.App()
    frame = main().Show()
    app.MainLoop()

Upvotes: 1

Related Questions