title: How to refresh a Grid class in wxpython?
body: <p>I am currently creating a program that configures IP connections, when I stumbled upon a problem in regards to the refreshing of the data in the Grid, for I have made a Grid class that contained SQL queries that execute once that class is loaded. Said Refresh function has to be done within the Remove, or Modify button.</p>
  
  <p>I have tried using ForceRefresh on the grid class, clearing the data then refreshing, and opening and closing the window altogether. 2 of which didn't work, and the last one just won't load the new data. </p>
  
  <pre><code>class MainTable(wx.grid.Grid):
      def __init__(self, parent):
          wx.grid.Grid.__init__(self, parent, -1)
  #Insert functions and SQL queries...
  
  class dspdtb(wx.Frame):
      def __init__(self, title, parent=None, style = wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLOSE_BOX | wx.CAPTION | wx.TRANSPARENT_WINDOW):
          wx.Frame.__init__(self, parent=parent, title=title)
  #More stuff below...
  
  
          btn2 = BP.ButtonInfo(titleBar, wx.ID_ANY, wx.Bitmap("button5 a.png", wx.BITMAP_TYPE_PNG))
          titleBar.AddButton(btn2)
          btn2.SetBitmap(wx.Bitmap("button5 b.png", wx.BITMAP_TYPE_PNG), status="Pressed")
          self.Bind(wx.EVT_BUTTON, self.Removal, btn2)
  
  #Still more stuff below...
  
          grid = MainTable(panel)
          vSizer.Add(titleBar, 0, wx.EXPAND)
          vSizer.Add((20, 20))
          vSizer.Add(grid, 0, wx.ALL | wx.CENTRE, 50)
          titleBar.DoLayout()
          vSizer.Layout()
          #toolbar end
          self.Show()
          self.Maximize(True)
  
  #Insert other functions here...
  
      def Removal(self, event):
          global l_a
          t = len(l_a)
          n = 0
          chk = wx.MessageBox('Do you wanna delete the selected items?', 'Confirm Deletion', wx.YES_NO)
          if chk==2:
              while(n&lt;t):
                  sasa = l_a[n]
                  print (sasa)
                  try: 
                      mycursor.execute("DELETE FROM ip_config WHERE id=%s;", (sasa,))
                  except mysql.connector.Error as err:
                      print("Something went wrong: {}".format(err))
                  mydb.commit()
                  n+=1
              wx.MessageBox('Rows now deleted, the table will now reload.', 'Deletion Completed', wx.OK)
          l_a=[]
          MainTable.ForceRefresh()
  
  </code></pre>
  
  <p>I needed the Program to Refresh either the dspdtb class or the Grid class to refresh the data. But when I have executed the program, this happens:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\Internal_IT\Desktop\IP automation\wxt.py", line 332, in Removal
      MainTable.ForceRefresh()
  TypeError: Grid.ForceRefresh(): first argument of unbound method must have type 'Grid'
  </code></pre>
  
  <p>Any kind of help is appreciated. Thanks in advance!</p>