title: Arguments in button command to change global variable value python tkinter
body: <p>I'm trying to get a set of buttons that will change the value of my global variable "y". I'm pretty new to python, and am very new to tkinter. I have tried using lambda and solutions in similar questions haven't seemed to fix the issue.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import tkinter as tk
  from tkinter import *
  
  
  master=Tk()
  
  def assignint(value):
      global y
      y = value
  
  y= StringVar()
  
  frame = Frame(master)
  frame.grid(row=0, columnspan=4)
  for i in range(2):
      Grid.rowconfigure(master,i,weight=1)
  for i in range(4):
      Grid.columnconfigure(master,i,weight=1)
  
  Button1 = Button(master,text='Fault1',command= lambda: assignint(0))
  Button1.grid(row=1, column=0,sticky=N+S+E+W)
  
  
  Button2 = Button(master,text='Fault2',command= lambda: assignint(1))
  Button2.grid(row=1, column=1,sticky=N+S+E+W)
  
  
  Button3 = Button(master,text='Fault3',command= lambda: assignint(2))
  Button3.grid(row=1, column=2,sticky=N+S+E+W)
  
  
  Button4= Button(master,text='Fault4',command= lambda: assignint(3))
  Button4.grid(row=1, column=3,sticky=N+S+E+W)
  
  if y.get()!='':
      print('The value of y is:', y.get())
  
  mainloop()
  </code></pre>