Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8138045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:22:21+00:00 2026-06-06T11:22:21+00:00

I have a wxPython GUI application that contains 13 pairs of StaticText controls that

  • 0

I have a wxPython GUI application that contains 13 pairs of StaticText controls that I would like to be able to set labels for problematically.

In terms of regression analysis, each pair of StaticText controls represents an independent variable and its coefficient. These key:value pairs are currently stored in a python dictionary, allowing me to use dictionary comprehension for much of my work.

Right now, I am struggling to display the contents of my python dictionary inside of my GUI. Any thoughts?

I am happy concatenating the key:value pair inside 1 StaticText control label, as I think it would be less messy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:22:22+00:00Added an answer on June 6, 2026 at 11:22 am

    I’m sure there are lots of different ways to do this. I would probably use a ListCtrl or better yet, ObjectListView. But I went ahead and created an example using StaticText controls:

    import wx
    
    ########################################################################
    class MyPanel(wx.Panel):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self, parent):
            """Constructor"""
            wx.Panel.__init__(self, parent)
    
            self.mainSizer = wx.BoxSizer(wx.VERTICAL)
            self.createControls()
            self.SetSizer(self.mainSizer)
    
        #----------------------------------------------------------------------
        def createControls(self):
            """"""
            myDict = {"var1":"co-eff1", "var2":"co-eff2",
                      "var3":"co-eff3", "var4":"co-eff4",
                      "var5":"co-eff5", "var6":"co-eff6",
                      "var7":"co-eff7", "var8":"co-eff8",
                      "var9":"co-eff9", "var10":"co-eff10",
                      "var11":"co-eff11", "var12":"co-eff12",
                      "var13":"co-eff13"}
            for key in myDict:
                lblOne = wx.StaticText(self, label=key)
                lblTwo = wx.StaticText(self, label=myDict[key])
    
                sizer = wx.BoxSizer(wx.HORIZONTAL)
                sizer.Add(lblOne, 0, wx.ALL, 5)
                sizer.Add(lblTwo, 0, wx.ALL, 5)
                self.mainSizer.Add(sizer)
    
    ########################################################################
    class MyFrame(wx.Frame):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self):
            """Constructor"""
            wx.Frame.__init__(self, None, title="Frame Example",
                              size=(400,400))
            panel = MyPanel(self)
            self.Show()
    
    if __name__ == "__main__":
        app = wx.App(False)
        frame = MyFrame()
        app.MainLoop()
    

    If you want to see what a ListCtrl looks like, go and download the wxPython demo package and look up the ListCtrl demo. For ObjectListView, you can read my tutorial.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wxPython application with some code like below. I want to set
I have a wxPython GUI. I would like to display the pdf object as
I have complex GUI application written in Python and wxPython. I want it to
I have a wxPython application with the various GUI classes in their own modules
I have recently been using WxPython to create a GUI Network simulator like Cisco
I have a GUI application that needs to do something simple in the background
I have a wxPython application that sends multipart emails with HTML and embedded images.
I have a wxPython application which contains a matplotlib panel (courtesy of wxmpl, though
I have an application that uses Flash for the GUI and Python for the
I have a two panel wxPython GUI set up. In my right panel, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.