I want Python to display data from Access on Label. I tried to do smth like this but it doesn't work. There is no error but Label displays pypyodbc.Cursor object at 0x05E02990. What should I do? Thank you
from tkinter import *
import pypyodbc
import ctypes
#Create connection
con = pypyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL={MS Access};DriverId=25;DefaultDir=C:/Users/HP/Desktop/PITL;DBQ=C:/Users/HP/Desktop/PITL/PITL.mdb;')
cursor = con.cursor ()
form = Tk ()
form.title ("Main")
form.geometry ('400x400')
form2 = Tk ()
form2.title ("Main")
form2.geometry ('400x400')
form2.withdraw()
def Show():
cursor.execute ("SELECT Law_ID FROM Laws WHERE Fine=1")
a=cursor.execute
for a in cursor:
print ("Law ID where Fine is 1 is", a)
Label(form2, text=cursor).pack()
form.withdraw()
form2.deiconify()
Button(form, text = 'PUSH ME', command = Show).pack()
form.mainloop ()
con.commit ()
cursor.close ()
con.close ()
print ("Law ID where Fine is 1 is", a)withprint ("Law ID where Fine is 1 is", list(a))?