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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:54:33+00:00 2026-06-02T18:54:33+00:00

How would I add another event to the pane created in our GUI manager

  • 0

How would I add another event to the pane created in our GUI manager class (below). I want to detect when the x button closes the pane. I’ve tried using the same format as wx.EVT_MENU for wx.EVT_CLOSE but it didn’t work.

    def popup_panel(self, p):
    """
    Add a panel object to the AUI manager

    :param p: panel object to add to the AUI manager

    :return: ID of the event associated with the new panel [int]

    """
    ID = wx.NewId()
    self.panels[str(ID)] = p
    self.graph_num += 1
    if p.window_caption.split()[0] in NOT_SO_GRAPH_LIST:
        windowcaption = p.window_caption
    else:
        windowcaption = 'Graph'#p.window_caption
    windowname = p.window_name

    # Append nummber
    captions = self._get_plotpanel_captions()
    while (1):
        caption = windowcaption + '%s'% str(self.graph_num)
        if caption not in captions:
            break
        self.graph_num += 1
        # protection from forever-loop: max num = 1000
        if self.graph_num > 1000:
            break
    if p.window_caption.split()[0] not in NOT_SO_GRAPH_LIST:
        p.window_caption = caption 
    #p.window_caption = windowcaption+ str(self.graph_num)
    p.window_name = windowname + str(self.graph_num)

    style1 = self.__gui_style & GUIFRAME.FIXED_PANEL
    style2 = self.__gui_style & GUIFRAME.FLOATING_PANEL
    if style1 == GUIFRAME.FIXED_PANEL:
        self._mgr.AddPane(p, wx.aui.AuiPaneInfo().
                          Name(p.window_name).
                          Caption(p.window_caption).
                          Position(10).
                          Floatable().
                          Right().
                          Dock().
                          MinimizeButton().
                          Resizable(True).
                          # Use a large best size to make sure the AUI 
                          # manager takes all the available space
                          BestSize(wx.Size(PLOPANEL_WIDTH, 
                                           PLOPANEL_HEIGTH)))

        self._popup_fixed_panel(p)

    elif style2 == GUIFRAME.FLOATING_PANEL:
        self._mgr.AddPane(p, wx.aui.AuiPaneInfo().
                          Name(p.window_name).Caption(p.window_caption).
                          MinimizeButton().
                          Resizable(True).
                          # Use a large best size to make sure the AUI
                          #  manager takes all the available space
                          BestSize(wx.Size(PLOPANEL_WIDTH, 
                                           PLOPANEL_HEIGTH)))

        self._popup_floating_panel(p)

    # Register for showing/hiding the panel
    wx.EVT_MENU(self, ID, self.on_view)
    if p not in self.plot_panels.values() and p.group_id != None:
        self.plot_panels[ID] = p
        if len(self.plot_panels) == 1:
            self.panel_on_focus = p
            self.set_panel_on_focus(None)
        if self._data_panel is not None and \
            self._plotting_plugin is not None:
            ind = self._data_panel.cb_plotpanel.FindString('None')
            if ind != wx.NOT_FOUND:
                self._data_panel.cb_plotpanel.Delete(ind)
            if caption not in self._data_panel.cb_plotpanel.GetItems():
                self._data_panel.cb_plotpanel.Append(str(caption), p)
    return ID

I want to be able to pick up the event in the plotting child class.

def create_panel_helper(self, new_panel, data, group_id, title=None):
    """
    """
    ## Set group ID if available
    ## Assign data properties to the new create panel
    new_panel.set_manager(self)
    new_panel.group_id = group_id
    if group_id not in data.list_group_id:
        data.list_group_id.append(group_id)
    if title is None:
        title = data.title
    new_panel.window_caption = title
    new_panel.window_name = data.title
    event_id = self.parent.popup_panel(new_panel)
    #remove the default item in the menu
    if len(self.plot_panels) == 0:
        pos = self.menu.FindItem(DEFAULT_MENU_ITEM_LABEL)
        if pos != -1:
            self.menu.Delete(DEFAULT_MENU_ITEM_ID)
    # Set UID to allow us to reference the panel later
    new_panel.uid = event_id
    # Ship the plottable to its panel
    wx.CallAfter(new_panel.plot_data, data) 
    self.plot_panels[new_panel.group_id] = new_panel

    # Set Graph menu and help string        
    helpString = 'Show/Hide Graph: '
    for plot in  new_panel.plots.itervalues():
        helpString += (' ' + plot.label + ';')
    self.menu.AppendCheckItem(event_id, new_panel.window_caption, 
                              helpString)
    self.menu.Check(event_id, IS_WIN)
    wx.EVT_MENU(self.parent, event_id, self._on_check_menu)
    wx.EVT_CLOSE(self.parent, event_id, self._on_close_panel)
    wx.EVT_SHOW(new_panel, self._on_show_panel)
  • 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-02T18:54:39+00:00Added an answer on June 2, 2026 at 6:54 pm

    Did you try catching wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE or wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED? I would think that would do what you want. I am assuming you’re using wx.aui rather than wx.agw.aui. I suspect the latter is similar though.

    EDIT: Oops. I read this wrong. I thought the OP wanted to know about AUINotebook. The event you’re probably looking for is wx.aui.EVT_AUI_PANE_CLOSE

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

Sidebar

Related Questions

I would like to open another swing gui after clicking a button and I
For my web-application I would like to add an object before another object inside
can I add a CCK image field to another CCK field ? I would
I'd like to write a gmail extension that would add a button on the
I want to stringify a number and add zero-padding, like how printf(%05d) would add
Would it be possible for me to dynamically add an event handler to a
If you want to create a handler for elements with the tab class, event
I'm using the CellClick event and would like to update another checkbox on the
I'm using Elmah with ASP.NET and wondering how I would add custom data, such
I thought every time you do a flash[:notice]=Message it would add it to the

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.