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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:13:43+00:00 2026-05-26T19:13:43+00:00

i am trying to put buttons underneath the listbox however everything i try seems

  • 0

i am trying to put buttons underneath the listbox however everything i try seems to distort or cause problems. I am hoping anyone can help me.

I want to put 2 buttons underneath the listbox and they should always change position depending on the size of the window (so it doesn’t dissapear), basicilly when you resize the window of the app it should change the position of the buttons.

Here is what i have so far

things_inlistbox=[]
things2_listbox=[]
things3listbox=[]
things4listbox=[]
import wx
def areachange(self,pg):
    print pg
    if pg=="Things":
        self.Things_area.Show()
    else:
        self.Things_area.Hide()

class things1tab(wx.Panel):
    def newAddImage(self,parent):
        things2_listbox.append('hi');
        self.listBox.Set(things2_listbox)
        self.listBox.SetSelection(len(things2_listbox)-1)
    def reName(self,parent):
        sel = self.listBox.GetSelection()
        text = self.listBox.GetString(sel)
        renamed = wx.GetTextFromUser('Rename item', 'Rename dialog', text)
        if renamed != '':
            things2_listbox.pop(sel)
            things2_listbox.insert(sel,renamed)
            self.listBox.Set(things2_listbox)
            self.listBox.SetSelection(sel)
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.listBox = wx.ListBox(self, size=(200, -1), choices=things2_listbox, style=wx.LB_SINGLE)
        self.sizer = wx.BoxSizer()
        self.sizerMain = wx.BoxSizer()
        self.listBox.Bind(wx.EVT_LISTBOX_DCLICK, self.reName)

        self.sizer.Add(self.listBox, proportion=0, flag=wx.TOP | wx.EXPAND | wx.LEFT, border=5)
        self.sizerMain.Add(self.sizer, proportion=0, flag=wx.BOTTOM | wx.EXPAND, border=70)
        self.SetSizer(self.sizerMain)
class imageArea(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        wx.StaticBox(self, -1, 'Personal Info', (400, 5), size=(240, 170))
        self.quote = wx.StaticText(self, label="Your quote :", pos=(20, 30), size=(200, -1))
        self.Show()

        self.SetSizer(self.sizerMain)
class things2tab(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        t = wx.StaticText(self, -1, "This is a PageTwo object", (40,40))

class things3tab(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        t = wx.StaticText(self, -1, "This is a PageThree object", (60,60))

class things4tab(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        t = wx.StaticText(self, -1, "This is a PageThree object", (400,60))

class MyNotebook(wx.Notebook):
    def __init__(self, *args, **kwargs):
        wx.Notebook.__init__(self, *args, **kwargs)

class MyPanel(wx.Panel):
    def OnPageChanged(self, event):
        new = event.GetSelection()
        areachange(self,self.notebook.GetPageText(new))
        event.Skip()

    def OnPageChanging(self, event):
        event.Skip()
    def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)
        self.notebook = MyNotebook(self, size=(225, -1))
#        self.button = wx.Button(self, label="Something else here? Maybe!")
        tab_Things = things1tab(self.notebook)
        tab_Things2 = things2tab(self.notebook)
        tab_Things3 = things3tab(self.notebook)
        tab_Things4 = things4tab(self.notebook)

        # add the pages to the notebook with the label to show on the tab
        self.notebook.AddPage(tab_Things, "Things",select=True)
        self.notebook.AddPage(tab_Things2, "Things2")
        self.notebook.AddPage(tab_Things3, "Things3")
        self.notebook.AddPage(tab_Things4, "Things4")
        self.Things_area=wx.StaticText(self, -1, "This is a PageOne object", (300,240))
        self.sizer = wx.BoxSizer()
        self.sizer.Add(self.notebook, proportion=0, flag=wx.EXPAND)
#        self.sizer.Add(self.button, proportion=0)
        self.SetSizer(self.sizer)
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
        areachange(self,self.notebook.GetPageText(0))        


class MainWindow(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        self.panel = MyPanel(self)

        self.Show()


app = wx.App(False)
win = MainWindow(None, size=(600, 400))
app.MainLoop()

I am not sure how to do this, if anyone could help me it would be greatly appiecated. If this is something simple please forgive me, however I have been stuck on this for days.

  • 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-26T19:13:44+00:00Added an answer on May 26, 2026 at 7:13 pm

    I’m not sure if this is what you mean or not, but try replacing your “things1tab” code with this and see if it works:

    class things1tab(wx.Panel):
        def newAddImage(self,parent):
            things2_listbox.append('hi');
            self.listBox.Set(things2_listbox)
            self.listBox.SetSelection(len(things2_listbox)-1)
        def reName(self,parent):
            sel = self.listBox.GetSelection()
            text = self.listBox.GetString(sel)
            renamed = wx.GetTextFromUser('Rename item', 'Rename dialog', text)
            if renamed != '':
                things2_listbox.pop(sel)
                things2_listbox.insert(sel,renamed)
                self.listBox.Set(things2_listbox)
                self.listBox.SetSelection(sel)
        def __init__(self, parent):
            wx.Panel.__init__(self, parent)
            self.listBox = wx.ListBox(self, size=(200, -1), choices=things2_listbox, style=wx.LB_SINGLE)
            self.sizer = wx.BoxSizer(wx.VERTICAL)
            btnSizer = wx.BoxSizer(wx.HORIZONTAL)
            self.sizerMain = wx.BoxSizer()
            self.listBox.Bind(wx.EVT_LISTBOX_DCLICK, self.reName)
            btn = wx.Button(self, label="Test")
            btnTwo = wx.Button(self, label="Test 2")
    
            self.sizer.Add(self.listBox, proportion=1, flag=wx.TOP | wx.EXPAND | wx.LEFT, border=5)
            btnSizer.Add(btn, 0, wx.ALL, 5)
            btnSizer.Add(btnTwo, 0, wx.ALL, 5)
            self.sizer.Add(btnSizer)
            self.sizerMain.Add(self.sizer, proportion=0, flag=wx.BOTTOM | wx.EXPAND, border=70)
            self.SetSizer(self.sizerMain)
    

    All I did was create a button sizer, add two buttons to it and nest it inside your “self.sizer”. I also changed the following proportion from zero to one:

    self.sizer.Add(self.listBox, proportion=1, flag=wx.TOP | wx.EXPAND | wx.LEFT, border=5)
    

    Hopefully that will help you get farther along.

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

Sidebar

Related Questions

We're trying to put together kiosk solution where we can charge people by hour
I'm trying to put buttons that have operators on them, like / * +
I'm trying to put two buttons on the screen and set them up so
I'm trying to put two buttons inside a panel using Swing widgets. Inside the
I'm trying to put some buttons at the bottom of my linear layout. The
I have a problem with IE7. I'm trying to put 2 buttons in the
What I am trying to do is put few buttons, made from PNG image,
I am trying to put share buttons into a website. I found a good
I'm trying to put a list of buttons side by side so they all
I'm trying to put these buttons inside my GridView: $extraButtons = array( 'class'=>'CButtonColumn', updateButtonLabel

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.