title: TypeError: get() missing 1 required positional argument: 'self' / Exception in Tkinter callback
body: <p>So i've been working on this project and for some reason this error keeps poping up:</p>
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File &quot;C:\Users\User\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py&quot;, line 1892, in __call__
      return self.func(*args)
    File &quot;D:\KPI\minesweeper\main.py&quot;, line 198, in login_verify
      username_1 = username_verify.get()
  TypeError: get() missing 1 required positional argument: 'self'
  </code></pre>
  <p>At first I've tried to combine .pack and grid in one class, but error occured, so I just put it off the class.
  Then I tried to add this .pack piece of code to the new class, but there still was a problem.
  TBO, this code kinda has different elements from different code, so i might've just got  confused.</p>
  <p>Here's a code:</p>
  <pre><code>from random import shuffle
  from tkinter import *
  from tkinter.messagebox import showinfo
  import os
  
  colors = {
      0: 'white',
      1: 'blue',
      2: 'green',
      3: 'red',
      4: 'purple',
      5: 'maroon',
      6: 'turquoise',
      7: 'black',
      8: 'gray',
  }
  
  
  class Autherisation:
      def __init__(self, master):
          self.screen = screen
  
  
  def delete2():
      screen3.destroy()
  
  
  def delete3():
      screen4.destroy()
  
  
  def delete4():
      screen5.destroy()
  
  def login_sucess():
      global screen3
      screen3 = Toplevel(screen)
      screen3.title('Sucess')
      screen3.geometry('150x100')
      Label(screen3, text='Login sucess').pack()
      Button(screen3, text='OK', command=delete2).pack()
  
  
  def password_not_recognised():
      global screen4
      screen4 = Toplevel(screen)
      screen4.title('Sucess')
      screen4.geometry('150x100')
      Label(screen4, text='Password not recognised').pack()
      Button(screen4, text='OK', command=delete3).pack()
  
  
  def user_not_found():
      global screen5
      screen5 = Toplevel(screen)
      screen5.title('Sucess')
      screen5.geometry('150x100')
      Label(screen5, text='User not found').pack()
      Button(screen5, text='OK', command=delete4).pack()
  
  
  def register_user():
      username_info = username_.get()
      password_info = password_.get()
  
      file = open(username_info, &quot;w&quot;)
      file.write(username_info + '\n')
      file.write(password_info)
      file.close()
  
      username_entry.delete(0, END)
      password_entry.delete(0, END)
  
      Label(screen_1, text='Registration successful!', fg='green', font=('calibri', 11)).pack()
  
  
  def login_verify():
      username_1 = username_verify.get()
      password_1 = password_verify.get()
      username_entry1.delete(0, END)
      password_entry1.delete(0, END)
  
      list_of_files = os.listdir()
      if username_1 in list_of_files:
          file1 = open(username_1, 'r')
          verify = file1.read().splitlines()
          if password_1 in verify:
              login_sucess()
          else:
              password_not_recognised()
      else:
          user_not_found()
  
  
  def register():
      global screen_1
      screen_1 = Toplevel(screen)
      screen_1.title(&quot;Register&quot;)
      screen_1.geometry('300x250')
  
      global username_
      global password_
      global username_entry
      global password_entry
      username_ = StringVar()
      password_ = StringVar()
  
      Label(screen_1, text='Please enter details below').pack()
      Label(screen_1, text='').pack()
      Label(screen_1, text='Username * ').pack()
      username_entry = Entry(screen_1, textvariable=username_)
      username_entry.pack()
      Label(screen_1, text='Password * ').pack()
      password_entry = Entry(screen_1, textvariable=password_)
      password_entry.pack()
      Button(screen_1, text='Register', width=10, height=1, command=register_user).pack()
  
  
  def login():
      global screen_2
      screen_2 = Toplevel(screen)
      screen_2.title(&quot;Login&quot;)
      screen_2.geometry('300x250')
      Label(screen_2, text='Please enter details below to login').pack()
      Label(screen_2, text='').pack()
  
      global username_verify
      global password_verify
  
      username_verify = StringVar
      password_verify = StringVar
      global username_entry1
      global password_entry1
      Label(screen_2, text='Username * ').pack()
      username_entry1 = Entry(screen_2, textvariable=username_verify)
      username_entry1.pack()
      Label(screen_2, text='').pack()
      Label(screen_2, text='Password * ').pack()
      password_entry1 = Entry(screen_2, textvariable=password_verify)
      password_entry1.pack()
      Label(screen_2, text='').pack()
      Button(screen_2, text='Login', width=10, height=1, command=login_verify).pack()
  
  
  def login_screen():
      global screen
      screen = Tk()
      screen.geometry(&quot;300x250&quot;)
      screen.title(&quot;Minesweeper&quot;)
      Label(text='MineSweeper', bg='grey', width='300', height='2', font=(&quot;calibri&quot;, 13)).pack()
      Label(text='').pack()
      Button(text='Login', height='2', width='30', command=login).pack()
      Label(text='').pack()
      Button(text=&quot;Register&quot;, height='2', width='30', command=register).pack()
  
      screen.mainloop()
  
  
  login_screen()
  
  
  class MyButton(tk.Button):
  
      def __init__(self, master, x, y, number=0, *args, **kwargs):
          super(MyButton, self).__init__(master, width=3, font='Calibri 15 bold', *args, **kwargs)
          self.x = x
          self.y = y
          self.number = number
          self.is_mine = False
          self.count_bomb = 0
          self.is_open = False
  
      def __repr__(self):
          return f'MyButton{self.x} {self.y} {self.number} {self.is_mine}'
  
  
  class MineSweeper:
      window = tk.Tk()
      window.title(&quot;MineSweeper&quot;)
      row_ = 16
      columns_ = 16
      mines = 60
      IS_GAME_OVER = False
      IS_FIRST_CLICK = True
  
      def __init__(self):
          self.buttons = []
  
          for i in range(MineSweeper.row_ + 2):
              temp = []
              for j in range(MineSweeper.columns_ + 2):
                  btn = MyButton(MineSweeper.window, x=i, y=j)
                  btn.config(command=lambda button=btn: self.click(button))
                  btn.bind('&lt;Button-3&gt;', self.right_click)
                  btn.bind('&lt;Double-Button-1&gt;', self.double_button_click)
                  temp.append(btn)
              self.buttons.append(temp)
  
      def right_click(self, event):
          if MineSweeper.IS_GAME_OVER:
              return
          cur_btn = event.widget
          if cur_btn['state'] == 'normal':
              cur_btn['state'] = 'disabled'
              cur_btn['text'] = ''
              cur_btn['disabledforeground'] = 'red'
          elif cur_btn['state'] == '':
              cur_btn['text'] = ''
              cur_btn['state'] = 'normal'
  
      def double_button_click(self, event):
          if MineSweeper.IS_GAME_OVER:
              return
          cur_btn = event.widget
          if cur_btn['state'] == 'normal':
              cur_btn['state'] = 'disabled'
              cur_btn['text'] = '?'
              cur_btn['disabledforeground'] = 'red'
          elif cur_btn['state'] == '?':
              cur_btn['text'] = ''
              cur_btn['state'] = 'normal'
  
      def click(self, clicked_button: MyButton):
  
          if MineSweeper.IS_GAME_OVER:
              return
  
          if MineSweeper.IS_FIRST_CLICK:
              self.insert_mines(clicked_button.number)
              self.count_mines_in_buttons()
              self.print_buttons()
              MineSweeper.IS_FIRST_CLICK = False
  
          print(clicked_button)
          if clicked_button.is_mine:
              clicked_button.config(text=&quot;*&quot;, background='red', disabledforeground='black')
              clicked_button.is_open = True
              MineSweeper.IS_GAME_OVER = True
              showinfo('Game over', 'Вы проиграли!')
              for i in range(1, MineSweeper.row_ + 1):
                  for j in range(1, MineSweeper.columns_ + 1):
                      btn = self.buttons[i][j]
                      if btn.is_mine:
                          btn['text'] = '*'
          else:
              color = colors.get(clicked_button.count_bomb, 'black')
              if clicked_button.count_bomb:
                  clicked_button.config(text=clicked_button.count_bomb, disabledforeground=color)
                  clicked_button.is_open = True
              else:
                  self.breadth_first_search(clicked_button)
          clicked_button.config(state='disabled')
          clicked_button.config(relief=tk.SUNKEN)
  
      def breadth_first_search(self, btn: MyButton):
          queue = [btn]
          while queue:
  
              cur_bth = queue.pop()
              color = colors.get(cur_bth.count_bomb, 'black')
              if cur_bth.count_bomb:
                  cur_bth.config(text=cur_bth.count_bomb, disabledforeground=color)
              else:
                  cur_bth.config(text='', disabledforeground=color)
              cur_bth.is_open = True
              cur_bth.config(state='disabled')
              cur_bth.config(relief=tk.SUNKEN)
  
              if cur_bth.count_bomb == 0:
                  x, y = cur_bth.x, cur_bth.y
                  for dx in [-1, 0, 1]:
                      for dy in [-1, 0, 1]:
                          # if not abs(dx - dy) == 1:
                          #     continue
  
                          next_btn = self.buttons[x + dx][y + dy]
                          if not next_btn.is_open and 1 &lt;= next_btn.x &lt;= MineSweeper.row_ and 1 &lt;= next_btn.y &lt;= MineSweeper.columns_ and next_btn not in queue:
                              queue.append(next_btn)
  
      def reload(self):
          [child.destroy() for child in self.window.winfo_children()]
          self.__init__()
          self.create_widgets()
          MineSweeper.IS_FIRST_CLICK = True
          MineSweeper.IS_GAME_OVER = False
  
      def create_username_login(self):
  
          win_log_in = tk.Toplevel(self.window)
          win_log_in.wm_title(&quot;Log in/sign in&quot;)
          tk.Label(win_log_in, text='Login').grid(row=0, column=0)
          login_entrys = tk.Entry(win_log_in)
          login_entrys.grid(row=0, column=1, padx=20, pady=20)
          tk.Label(win_log_in, text='Password').grid(row=1, column=0)
          password_entrys = tk.Entry(win_log_in)
          password_entrys.grid(row=1, column=1, padx=20, pady=20)
          my_file = open('user.txt', 'w')
          my_file.write('login_entry')
          my_file.write('password_entry')
          # with open(&quot;file.text&quot;, &quot;r&quot;) as file:
          #     data = file.readlines()
          #     for line in data:
          #         word = line.split()
          #         print(word)
  
      def create_widgets(self):
          menubar = tk.Menu(self.window)
          self.window.config(menu=menubar)
  
          settings_menu = tk.Menu(menubar, tearoff=0)
  
          settings_menu.add_command(label='Save')
          settings_menu.add_command(label='Log in', command=self.create_username_login)
          settings_menu.add_command(label='Start over', command=self.reload)
          settings_menu.add_command(label='Finish', command=self.window.destroy)
          menubar.add_cascade(label='File', menu=settings_menu)
  
          settings_menu = tk.Menu(menubar, tearoff=0)
  
          settings_menu.add_command(label='Novice')
          settings_menu.add_command(label='Amateur')
          settings_menu.add_command(label='Professional')
          menubar.add_cascade(label='Mode', menu=settings_menu)
  
          count = 1
          for i in range(1, MineSweeper.row_ + 1):
              for j in range(1, MineSweeper.columns_ + 1):
                  btn = self.buttons[i][j]
                  btn.number = count
                  btn.grid(row=i, column=j, stick='NWES')
                  count += 1
  
          for i in range(1, MineSweeper.row_ + 1):
              tk.Grid.rowconfigure(self.window, i, weight=1)
  
          for j in range(1, MineSweeper.columns_ + 1):
              tk.Grid.columnconfigure(self.window, i, weight=1)
  
      def open_all_buttons(self):
          for i in range(MineSweeper.row_ + 2):
              for j in range(MineSweeper.columns_ + 2):
                  btn = self.buttons[i][j]
                  if btn.is_mine:
                      btn.config(text=&quot;*&quot;, background='red', disabledforeground='black')
                  elif btn.count_bomb in colors:
                      color = colors.get(btn.count_bomb, 'black')
                      btn.config(text=btn.count_bomb, foreground=color)
  
      def start(self):
  
          self.create_widgets()
          # self.login_screen()
          # self.open_all_buttons()
          # self.create_username_login()
          MineSweeper.window.mainloop()
  
      def print_buttons(self):
          for i in range(1, MineSweeper.row_ + 1):
              for j in range(1, MineSweeper.columns_ + 1):
                  btn = self.buttons[i][j]
                  if btn.is_mine:
                      print(&quot;B&quot;, end='')
                  else:
                      print(btn.count_bomb, end='')
              print()
  
      def insert_mines(self, number: int):
          index_mines = self.get_mines_places(number)
          print(index_mines)
          for i in range(1, MineSweeper.row_ + 1):
              for j in range(1, MineSweeper.columns_ + 1):
                  btn = self.buttons[i][j]
                  if btn.number in index_mines:
                      btn.is_mine = True
  
      def count_mines_in_buttons(self):
          for i in range(1, MineSweeper.row_ + 1):
              for j in range(1, MineSweeper.columns_ + 1):
                  btn = self.buttons[i][j]
                  count_bomb = 0
                  if not btn.is_mine:
                      for row_dx in [-1, 0, 1]:
                          for col_dx in [-1, 0, 1]:
                              neighbour = self.buttons[i + row_dx][j + col_dx]
                              if neighbour.is_mine:
                                  count_bomb += 1
                  btn.count_bomb = count_bomb
  
      @staticmethod
      def get_mines_places(exclude_number: int):
          indexes = list(range(1, MineSweeper.columns_ * MineSweeper.row_ + 1))
          print(f&quot; {exclude_number}&quot;)
          indexes.remove(exclude_number)
          shuffle(indexes)
          return indexes[:MineSweeper.mines]
  
  
  game = MineSweeper()
  game.start()
  </code></pre>