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 3486862
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:04:53+00:00 2026-05-18T11:04:53+00:00

hey :) ok im looking for a way to create a large number of

  • 0

hey 🙂
ok im looking for a way to create a large number of panels in wxpython and append a hold to them in a list but am not sure how best to do this. for example
for i in list:
wx.Panel(self, -1, pos, size) #create the panel

somehow store a hold to it e.g

anotherlist.append(a) #where a is the hold to the panel
when i say hold i mean say the variable name is x, so
x = wx.Panel. i would call x the hold cos x can be used for any manipulation of the widget, e.g x.SetPosition etc.. i was thinking maybe using a class something(wx.Panel) that creates the panel and saves the id of the panel.. problem is having the id i have no idea how to access the widget. say the panels id is -206. how do i do something like widgetid(-206).SetBackgroundColour(“RED”)

  • 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-05-18T11:04:53+00:00Added an answer on May 18, 2026 at 11:04 am

    Some people solve these sorts of things by creating the ids at the beginning of the file:

    panelOneId = wx.NewId()
    panelTwoId = wx.NewId()
    

    And then doing something like myPanel = wx.FindWindowById(panelOneId). Of course, if all you’re doing is setting panel attributes, it might just behoove you to create a helper method like this:

    #----------------------------------------------------------------------
    def createPanel(self, sizer, id, bg):
        """"""
        panel = wx.Panel(self, id=id)
        panel.SetBackgroundColour(bg)
        sizer.Add(panel)
    

    You can also use wx.FindWindowByName, if you’ve given the panels unique name parameters.

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

Sidebar

Related Questions

No related questions found

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.