I am trying a mini project just for my practice purpose, here when i enter the value '1' when i run this program, the option.get() is not accepting the value from 'entry' , because it is not printing "Your existing balance is 10000".
Please note that i have call user_choice function to process to next steps, this is just one part of rest of the project.
If it is accepting it should be printing "Your existing balance is 10000" Please help, thanks in advance.
Please note that i have call user_choice function to process to next steps, this is just one part of rest of the project.
If it is accepting it should be printing "Your existing balance is 10000" Please help, thanks in advance.
import tkinter as tk
global balance
balance= 10000
def user_choice():
a = (option.get()) #not able to accept input from the entry
if(a==1):
print("You existing Balance is ",balance)
#if(a==2):
root1 = tk.Tk()
option = tk.StringVar()
canvas = tk.Canvas(root1,height=500,width=500)
canvas.pack()
frame = tk.Frame(root1,bg='#80c1ff')
frame.place(relx=0.1,rely=0.1,relwidth=0.8,relheight=0.8)
label = tk.Label(frame,
text="|| Enter number 1-4 || \n Please Choose your options",bg="yellow")
label.place(relx=0.15,rely=0.1,relwidth=0.7)
label = tk.Label(frame,
text="\n 1- Check saving Balance \n 2- Deposit Funds \n 3- Withdraw Funds \n 4- Transfer Funds ",bg="yellow")
label.place(relx=0.15,rely=0.2,relwidth=0.7)
entry = tk.Entry(root1,bg="gray",textvariable=option) #HERE is the INPUT VALUE Entering
entry.place(relx=0.45,rely=0.43,relwidth=0.09)
button = tk.Button(master=root1, text='OK',bg='purple',activebackground='pink',fg='white',command=user_choice) #Here I am calling the function
button.place(relx=0.41,rely=0.489,relwidth=0.16)
root1.mainloop()
