Python GUI program in wxPython won't run
<p>I have the following code, and I am following a tutorial:</p>

<p>(<a href="http://zetcode.com/wxpython/layout/" rel="nofollow">http://zetcode.com/wxpython/layout/</a> - GoToClass part)</p>

<p>I can't figure out what is wrong with it ... :/</p>

<p>As you can see in the tutorial, it is supposed to produce this:</p>

<p><a href="https://i.stack.imgur.com/JbT3I.png" rel="nofollow"><img src="https://i.stack.imgur.com/JbT3I.png" alt="enter image description here"></a></p>

<p>The code:</p>

<pre><code>#!/usr/bin/python
# -*- coding: utf-8 -*-

# gotoclass.py

import wx

class Example(wx.Frame):

    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title, 
            size=(390, 350))

        self.InitUI()
        self.Centre()
        self.Show()     

    def InitUI(self):

        panel = wx.Panel(self)

        font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
        font.SetPointSize(9)

        vbox = wx.BoxSizer(wx.VERTICAL)

        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        st1 = wx.StaticText(panel, label='Class Name')
        st1.SetFont(font)
        hbox1.Add(st1, flag=wx.RIGHT, border=8)
        tc = wx.TextCtrl(panel)
        hbox1.Add(tc, proportion=1)
        vbox.Add(hbox1, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=10)

        vbox.Add((-1, 10))

        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        st2 = wx.StaticText(panel, label='Matching Classes')
        st2.SetFont(font)
        hbox2.Add(st2)
        vbox.Add(hbox2, flag=wx.LEFT | wx.TOP, border=10)

        vbox.Add((-1, 10))

        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        tc2 = wx.TextCtrl(panel, style=wx.TE_MULTILINE)
        hbox3.Add(tc2, proportion=1, flag=wx.EXPAND)
        vbox.Add(hbox3, proportion=1, flag=wx.LEFT|wx.RIGHT|wx.EXPAND, 
            border=10)

        vbox.Add((-1, 25))

        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        cb1 = wx.CheckBox(panel, label='Case Sensitive')
        cb1.SetFont(font)
        hbox4.Add(cb1)
        cb2 = wx.CheckBox(panel, label='Nested Classes')
        cb2.SetFont(font)
        hbox4.Add(cb2, flag=wx.LEFT, border=10)
        cb3 = wx.CheckBox(panel, label='Non-Project classes')
        cb3.SetFont(font)
        hbox4.Add(cb3, flag=wx.LEFT, border=10)
        vbox.Add(hbox4, flag=wx.LEFT, border=10)

        vbox.Add((-1, 25))

        hbox5 = wx.BoxSizer(wx.HORIZONTAL)
        btn1 = wx.Button(panel, label='Ok', size=(70, 30))
        hbox5.Add(btn1)
        btn2 = wx.Button(panel, label='Close', size=(70, 30))
        hbox5.Add(btn2, flag=wx.LEFT|wx.BOTTOM, border=5)
        vbox.Add(hbox5, flag=wx.ALIGN_RIGHT|wx.RIGHT, border=10)

        panel.SetSizer(vbox)


if __name__ == '__main__':

    app = wx.App()
    Example(None, title='Go To Class')
    app.MainLoop()
</code></pre>

<p>The following are the errors I'm getting: (Removed the path to the file</p>

<pre><code>Traceback (most recent call last):
  File "[path]", line 78, in &lt;module&gt;
    Example(None, title='Go To Class')
  File "[path]", line 14, in __init__
    self.InitUI()
  File "[path]", line 21, in InitUI
    font = wx.SystemSettings_GetFont(wx.SYS_SYSTEM_FONT)
AttributeError: 'module' object has no attribute 'SystemSettings_GetFont'
</code></pre>

<p>It's just a typo. The correct way is <code>wx.SystemSettings.GetFont()</code>, also see this: <a href="https://wxpython.org/Phoenix/docs/html/wx.SystemSettings.html#wx.SystemSettings.GetFont" rel="nofollow">https://wxpython.org/Phoenix/docs/html/wx.SystemSettings.html#wx.SystemSettings.GetFont</a></p>

<p>Change your InitUI function to this:</p>

<pre><code>def InitUI(self):
    panel = wx.Panel(self)

    font = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
    font.SetPointSize(9)
    ...
</code></pre>

<p>Hope this helps!</p>

python wxpython