简体   繁体   中英

PysimpleGUI user input

I need to use the values from the user input as strings, but they come like this ('user input',), I need to take out the ('',).

layout = [ [sg.Text("window")], [sg.Text("costumer name"), sg.InputText(key="insert name")],

so after executing the event( user clicks the button)

costumer = values["insert name"],

print (costumer)

When a print the user input I get it ('costumer name jhon',) , so my problem is, how I get the user input without ('',), I only want = "costumer name is jhon"

As @JasonYang pointed out, it is because of the comma on this line:

costumer = values["insert name"],

The comma makes costumer into a one-element tuple. Remove the comma.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM