![]() |
Keeps showing prevuios inputs - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Keeps showing prevuios inputs (/thread-23551.html) |
Keeps showing prevuios inputs - _ShevaKadu - Jan-05-2020 ![]() ![]() ![]() 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: The first output: but it should be Input No.1The second output but it should be Input No.2Videos: PLEASE WATCH THE VIDEO CAREFULLY! PAY ATTENTION TO THE IDLE SHELL AND THE TKINTER WINDOWS! Thanks! RE: Keeps showing prevuios inputs - Gribouillis - Jan-06-2020 Start by adding print('msg_return({})'.format(repr(returnvalue))) in function msg_return to see if it gets correctly called.
RE: Keeps showing prevuios inputs - Denni - Jan-07-2020 What are you using ? Tkinter, PyQt, PySide2 or something else RE: Keeps showing prevuios inputs - _ShevaKadu - Jan-08-2020 (Jan-07-2020, 04:01 PM)Denni Wrote: What are you using ? Tkinter, PyQt, PySide2 or something else I use Tkinter. RE: Keeps showing prevuios inputs - _ShevaKadu - Feb-15-2020 (Jan-06-2020, 09:34 AM)Gribouillis Wrote: Start by adding It does @Gribouillis
RE: Keeps showing prevuios inputs - Gribouillis - Feb-17-2020 I'm afraid you'll have to post the whole code. It is difficult to diagnose an error with incomplete information. |