Hello, everyone, I'm new to wxPython
I want to write a small program that link the menu in one frame with another frame that I created after. I've tried to use like EVT_BUTTON, but it won't work. How am I supposed to do this?
Thx for any help

Here is an example how to access one frame from the other via the instance ...

# create two frames with wxFrame
# access one frame from the other

import wx
import random

class Frame1(wx.Frame):
    def __init__(self, parent):
        # self will be the Frame1 instance
        wx.Frame.__init__(self, parent, wx.ID_ANY, title='Frame1', pos=(50, 50))
        # create a Frame2 instance, pass Frame1 instance self to Frame2
        self.frame2 = Frame2(None, self)
        # show Frame2

        # create a button
        self.button1 = wx.Button(self, wx.ID_ANY, label='change Frame2 color')
        # bind mouse event to an action
        self.button1.Bind(wx.EVT_BUTTON, self.button1Click)

        # use a box sizer to lay out widgets
        sizer_v = wx.BoxSizer(wx.VERTICAL)
        # Add(widget, proportion, flag, border)
        sizer_v.Add(self.button1, 0, flag=wx.ALL, border=10)

    def button1Click(self, event):
        button1 has been left clicked, do something
        color_list = ['red', 'blue', 'white', 'yellow', 'magenta', 'black']
        # pick a color from the color_list at random
        color = random.choice(color_list)
        print(color)  # test
        # change color of Frame2 via instance self.frame2
        # now clear old colour, set to new colour

class Frame2(wx.Frame):
    # notice how the Frame1 instance is passed
    def __init__(self, parent, frame1):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title='Frame2', pos=(450, 150))
        # in case you have to use the Frame1 instance within Frame2 methods
        self.frame1 = frame1

app = wx.App(0)
# create a Frame1 instance and show the frame
frame1 = Frame1(None)
this may be what I need to my problem
This article has been dead for over six months. Start a new discussion instead.