Skip to content
Related Articles

Related Articles

wxPython – GetDefaultSize() function in wx.Button
  • Last Updated : 18 Jun, 2020

In this article we are going to learn about GetDefaultSize() function associated with wx.Button class of wxPython. GetDefaultSize() function is used to return the default size for the buttons.

It is advised to make all the dialog buttons of the same size and this function allows retrieving the (platform, and current font dependent) size which should be the best suited for this.

Syntax: wx.Button.GetDefaultSize(win=None)


ParameterInput TypeDescription
winwx.WindowParent Window.

Return Type: wx.Size

Code Example:

import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        self.pnl = wx.Panel(self)
        self.btn = wx.Button(self.pnl, label ='Button'
                             pos =(20, 20), size =(100, 20))
        s = self.btn.GetDefaultSize(self)
        self.SetSize((350, 250))
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':

Console Output:

(88, 26)

Output Window:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :