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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:37:19+00:00 2026-06-07T13:37:19+00:00

How do you open a child frame when a button is clicked on the

  • 0

How do you open a child frame when a button is clicked on the main window?
The code below creates a drop down box. My problem is I have a separate class for the main window and I don’t how to open this new drop down box window in my main application.
The main window is just a wx.frame with a button added to it.

import wx
class MyFrame(wx.Frame):

    def __init__(self ):
        wx.Frame.__init__(self, None, -1, 'wxChoice test', size=(300, 150))
        colorList = ['blue','green','yellow','red']
        # create the dropdown box
        self.choice1 = wx.Choice(self, -1, choices=colorList)

        # select item 1 = 'green' to show
        self.choice1.SetSelection(1)
        # set focus to receive optional keyboard input
        # eg. type r for red, y for yellow
        self.choice1.SetFocus()
        # new event handler wxPython version 2.5 and higher
        self.choice1.Bind(wx.EVT_CHOICE, self.onChoice)
    def onChoice(self, event):
        '''get the slected color choice'''
        self.color = self.choice1.GetStringSelection()
        self.SetTitle(self.color) # test



# this is only a small application
application = wx.PySimpleApp()
# call class MyFrame
frame1 = MyFrame()
# show the frame
frame1.Show(True)
# start the event loop
application.MainLoop()
  • 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-07T13:37:22+00:00Added an answer on June 7, 2026 at 1:37 pm

    simplest example I could make in a few mins
    import wx

    def show_other(evt):
        f2 = wx.Frame(None,-1)
        c = wx.Choice(f2,-1,choices=['red','blue','green'])
        f2.Show()
    
    a = wx.App(redirect = False)
    
    
    f = wx.Frame(None,-1)
    b = wx.Button(f,wx.ID_OK)
    b.Bind(wx.EVT_BUTTON,show_other)
    f.Show()
    a.MainLoop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Open child browser window from child window I have a list of
I have a WPF Window that open a modal child window to load some
I have this function which is supposed to open up a child window using
I used JavaScript to open a new window(child) when user clicks on button from
Creating a popup window from main page with window.open, the child/popup page uses the
On a submit button click, I want to open a child window and redirect
I am using main form and child forms. If I open 2nd child form
I am trying to create a child window in WPF.this child window should open
I have a parent form and a child form. I need to open the
I have two file A.html <a href=B.html>B</a> <script> var mywindow = open(child.html,child, height=200,width=200); </script>

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.