import wx

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

# 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)

app.MainLoop()

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.