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

The Archive Base Latest Questions

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

I am not sure how I should size this, I have been trying to

  • 0

I am not sure how I should size this, I have been trying to use sizer but it seems i am doing something wrong all the time.

Basically i have this code:

self.button = wx.Button(self, label="Create New", pos=(25,250))

and i would like to use a sizer with it. So it will adjust its position always to the window. The initial starting position is 25, 250. The height of the initial window is 400.
I would like the button to adjust accordingly to the window changes.

Thank you, please comment if you have any questions or need clarification.

  • 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-26T22:03:14+00:00Added an answer on May 26, 2026 at 10:03 pm

    Here you have a wxglade automatically-generated code showing how to use a wx.BoxSizer.
    It is simply a Frame with a panel widget. You can change the panel with your button and it will work perfectly. The idea is that you could add other widgets as it is done for the wx.Panel in:

    sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
    

    this produce your widgets being situated in a row. If you want another disposition you could use a different sizer, You can also add sizers with widgets to other sizers. The parameters in sizer.Add() determine the borders and behavior of the sizer. You should check wxPython/wxglade documentation for that. Anyway, the estructure is always like the one below:

    import wx
    
    # begin wxGlade: extracode
    # end wxGlade
    
    class MyFrame1(wx.Frame):
        def __init__(self, *args, **kwds):
            # begin wxGlade: MyFrame1.__init__
            kwds["style"] = wx.CLOSE_BOX|wx.SYSTEM_MENU| wx.CAPTION
            wx.Frame.__init__(self, *args, **kwds)
            self.panel_1 = wx.Panel(self, -1)
            ------ create other widgets here ------
    
            self.__set_properties()
            self.__do_layout()
            # end wxGlade
    
        def __set_properties(self):
            # begin wxGlade: MyFrame1.__set_properties
            self.SetTitle("frame_2")
            self.SetMinSize((300,200))
            # end wxGlade
    
        def __do_layout(self):
            # begin wxGlade: MyFrame1.__do_layout
            sizer_2 = wx.BoxSizer(wx.VERTICAL)
            sizer_2.Add(self.panel_1, 1, wx.EXPAND, 0)
            ------ add other widgets or even sizers to the sizer here ------
            self.SetSizer(sizer_2)
            sizer_2.Fit(self)
            self.Layout()
            # end wxGlade
    
    # end of class MyFrame1
    
    if __name__ == "__main__":
        app = wx.PySimpleApp(0)
        wx.InitAllImageHandlers()
        frame_1 = MyFrame1(None, -1, "")
        app.SetTopWindow(frame_1)
        frame_1.Show()
        app.MainLoop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not 100% sure how I should word this question but I'll try my
I've been trying to find a solution to this, but perhaps I'm not understanding
I'm using cocos2d for iOS. Not sure if I'm doing something wrong here or
I am not sure what I should be doing here. Should I be hardcoding
Preface : I'm honestly not sure if this should be on StackOverflow, SuperUser or
Many GDI+ classes implement IDisposable, but I'm not sure when I should call Dispose.
I'm not even sure how I should phrase this question. I'm passing some CustomStruct
Note: Not sure if this is the right stack, please tell if I should
This is very puzzling and I am not even sure what code should I
I'm still a novice and I'm not sure how I should setup the profile

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.