import wx

# create window
app = wx.App()
win = wx.Frame(None, title = "Simple Editor", size = (410, 335))

# create buttons
loadButton = wx.Button(win, label = 'Open',
                       pos = (225, 5), size = (80, 25))
saveButton = wx.Button(win, label = 'Save',
                       pos = (315, 5), size = (80, 25))

fileName = wx.TextCtrl(win, pos = (5, 5), size = (210, 25))

contents = wx.TextCtrl(win, pos = (5, 35), size = (390, 260),
                       style = wx.TE_MULTILINE | wx.HSCROLL)


In the program above, is the 'win' argument telling the Button and TextCtrl classes that they inherit from the Frame class? If not, what are they, what do they, and how do they work? Thanks.

When you want to add controls like buttons, textctrl, you must tell the program where to place them. The 'win' argument which inherits from wxWindow serves this purpose.

The arguments/parameters for the button are
wx.Button(parent, id, label, pos, size, style, name)
A number of these arguments have defaults, but parent has to be specified.
It is the frame, panel or other surface where the button will appear on.
In your case win is the parent and is the instance of that particular frame.

Edited 6 Years Ago by vegaseat: win

This question has already been answered. Start a new discussion instead.