Jan-05-2020, 11:59 AM



Hello!
I'm making a Python module to get customised pop-ups.
But when I save the output to a variable (var = func(a, b)), and then print it out, it prints out the input I entered previously! Why?
Codes:
msg_return(return value) function code:
def msg_return(returnvalue): global msg_outputvalue msg_outputvalue = returnvalue msg_outputvalue = returnvalueentry1 code:
elif msgbox_widgets == 'input': msgbox_entry1 = Entry(msgbox_window, width=32, font=('Futura', 16)) msgbox_entry1.place(x=145, y=82) msgbox_button1 = Button(msgbox_window, text='Cancel', fg='gray70', font=('Futura', 20), command= lambda: [msg_return('"Cancel"_button-clicked'), msgbox_window.destroy()]) msgbox_button1.place(x=438, y=82) msgbox_button2 = Button(msgbox_window, text='Okay', fg='gray70', font=('Futura', 20), command= lambda: [msg_return(msgbox_entry1.get()), msgbox_window.destroy()]) msgbox_button2.place(x=390, y=82)widget checker whole code:
if msgbox_widgets == 'ok_cancel': msgbox_button1 = Button(msgbox_window, text='Cancel', fg='gray70', font=('Futura', 20), command= lambda: [msg_return('"Cancel"_button-clicked'), msgbox_window.destroy()]) msgbox_button1.place(x=438, y=82) msgbox_button2 = Button(msgbox_window, text='Okay', fg='gray70', font=('Futura', 20), command= lambda: [msg_return('"Okay"_button-clicked'), msgbox_window.destroy()]) msgbox_button2.place(x=390, y=82) elif msgbox_widgets == 'input': msgbox_entry1 = Entry(msgbox_window, width=32, font=('Futura', 16)) msgbox_entry1.place(x=145, y=82) msgbox_button1 = Button(msgbox_window, text='Cancel', fg='gray70', font=('Futura', 20), command= lambda: [msg_return('"Cancel"_button-clicked'), msgbox_window.destroy()]) msgbox_button1.place(x=438, y=82) msgbox_button2 = Button(msgbox_window, text='Okay', fg='gray70', font=('Futura', 20), command= lambda: [msg_return(msgbox_entry1.get()), msgbox_window.destroy()]) msgbox_button2.place(x=390, y=82) else: print('CONSOLE ERROR: No such supported pop-up type: ' + msgbox_type) return msg_outputvalue #Usage: msg_showmsgbox('warning_message', 'title', 'content Hello! Welcome to a brand new oper\nating system corwinus! ', 'ok_cancel')
Basically, I want the user to input something in the entry box and then I want to print it out!
But the output is wrong! It shows the previous value of the entry1.get()!
The first value which was set to the msg_output:
Output:None
The first output:Output:None
but it should be Input No.1The second output
Output:Input No.1
but it should be Input No.2Videos: PLEASE WATCH THE VIDEO CAREFULLY! PAY ATTENTION TO THE IDLE SHELL AND THE TKINTER WINDOWS!
Thanks!