Name Error and other?
<p>Basically I'm learning Python right now so I'm just using other people's templates and just editing them. So far, I've learned that indention in Python is very picky.
However I'm stuck, I think I have everything indented correctly and definedright, but I'm still getting this error in my console. (windows)</p>

<p>(And yes, I know it's not done yet)</p>

<pre><code>"...\documents\python_files&gt;python calc.py
Traceback (most recent call last):
  File "calc.py", line 20, in &lt;module&gt;
    class Calculator(wx.Dialog):
  File "calc.py", line 46, in Calculator
    b = wx.Button(self, -1, label)
NameError: name 'self' is not defined"
</code></pre>

<p>Here is my code (I <em>think</em> I put it here in code format):</p>

<pre><code># -*- coding: utf-8 -*-
from __future__ import division

__author__ = 'Sean'
__version__ = '0.0.2'

#Calculator GUI:

# ____________v
#[(][)][^][log]
#[C][±][√][%]
#[7][8][9][/]
#[4][5][6][*]
#[1][2][3][-]
#[0][.][+][=]

import wx
from math import *

class Calculator(wx.Dialog):
    '''Main calculator dialog'''
    def __init__(self):
        title = 'Calculator version %s' % __version__
        wx.Dialog.__init__(self, None, -1, title)
        sizer = wx.BoxSizer(wx.VERTICAL) # Main vertical sizer

        # ____________v
        self.display = wx.ComboBox(self, -1)
        sizer.Add(self.display, 0, wx.EXPAND)


    #[(][)][^][log]
    #[C][±][√][%]
    #[7][8][9][/]
    #[4][5][6][*]
    #[1][2][3][-]
    #[0][.][+][=]
    gsizer = wx.GridSizer(4,6)
    for row in (("(",")","^","log"),
    ("C","±","√","%"),
    ("7", "8", "9", "/"),
    ("4", "5", "6", "*"),
    ("1", "2", "3", "-"),
    ("0", ".", "+", "=")):
        for label in row:
            b = wx.Button(self, -1, label)
            gsizer.Add(b)
            self.Bind(wx.EVT_Button,self.OnButton, b)
            sizer.Add(gsizer, 1, wx.EXPAND)

    b = wx.Button(self, -1, "=")
    self.Bind(wx.EVT_BUTTON, self.OnButton, b)
    sizer.Add(b, 0, wx.EXPAND)
    self.equal = b

    self.SetSizer(sizer)
    sizer.Fit(self)
    self.CenterOnScreen()

def OnButton(self, evt):
    '''Handle button click event'''
    label = evt.GetEventObject().GetLabel()

    if label == '=':
        try:
            compute = self.display.GetValue()
            if not compute.strip():
                return

            result = eval(compute)

            self.display.Insert(compute, 0)

            self.display.SetValue(str(result))
        except Exception as err:
            wx.LogError(str(err))
            return

    elif label == 'C':
        self.display.SetValue('')

    else:
        self.display.SetValue(self.display.GetValue() + label)
        self.equal.SetFocus()

if __name__ == '__main__':
    app = wx.PySimpleApp()
    dlg = Calculator()
    dlg.ShowModal()
    dlg.Destroy()
</code></pre>
