SimpleGui inputs into a variable

pysimplegui
pysimplegui github
pysimpleguiweb tutorial
pysimplegui reddit
pysimplegui vs tkinter
pysimplegui pypi

On simplegui I want there to be an input box called login_gui that puts the data from the input into the variable login_variable, not into a defined function.

import simplegui
frame = simplegui.create_frame("screen", 500, 500)
login_gui = frame.add_input("Login?", login_variable, 20)
 ..something with login_variable

Is there any way to do this, or is it only with defined functions that this works?

I don't know. But using tkinter or pyside is very simple and then you have all options avaliable.

updated with an example

Basically pyside is better, but tkinter works out of the box. If you just want a simple gui, just use tkinter

from Tkinter import *

def go():
    print E1.get()
top = Tk()
L1 = Label(top, text="User Name")
L1.pack()
E1 = Entry(top, bd =5)
E1.pack()

But = Button(top, text="go", command=go)
But.pack()
top.mainloop()

python - SimpleGui inputs into a variable, On simplegui I want there to be an input box called login_gui that puts the data from the input into the variable login_variable, not into a defined  With a simple GUI, it becomes practical to "associate" .py files with the python interpreter on Windows. Double click a py file and up pops a GUI window, a more pleasant experience than opening a dos Window and typing a command line. There is even a PySimpleGUI program that will take your PySimpleGUI program and turn it into an EXE.

You can retrieve the input string by calling the get_text() method of the variable that is assigned to the input field.

login_variable = login_gui.get_text()

Please note that you will still have to define an input handler function somewhere, but can leave it blank (and do not name it login_variable as you're using it to store the input text)

def input_handler(input):
     pass

login_gui = frame.add_input("Login?", input_handler, 20)

Source: SimpleGui documentation.

Saving user input in a variable : PySimpleGUI, Saving user input in a variable. I built a simple gui and would like to capture the user's selection as a tuple. The code down below does that but also produces a  Here I have the template, alright? The first thing that I'm going to do, is make sure that I import the simple gui module. If I don't import the SimpleGUI module, I can't do any of this. Now, we're going to define a global variable. Let's define an a global variable called counter, and let's initialize it to zero.

you can just call the box with name and use it

name = enterbox("Enter the company name:", "Name") msgbox("Hello " + name) # will show what you entered

Cookbook, Now look at the layout variable and then look at the window graphic below. The first is to simply throw a simple GUI onto the front of an existing command line the input values (what button they clicked, what was input in the Input Element) Storing and Responding to User Input. V: Variable. Associates a variable with a control. Immediately after the letter V, specify the name of a global variable (or a ByRef local that points to a global, or [in v1.0.46.01+] a static variable).

PySimpleGUI, Input fields can be used to call functions multiple times. 6. # while the program is import simplegui. 16. ​. 17. # Global Variables. 18. ​. 19. canvas_width =  SimpleGui inputs into a variable. I don't know. But using tkinter or pyside is very simple and then you have all options avaliable. updated with an example Basically

Input Fields with Functions, Input Checking. 3. ​. 4. # Checking for valid input can avoid errors in your program. 5 import simplegui. 9. ​. 10. # Global Variables. 11. ​. 12. canvas_width =  Accept input for the name of the computer to query; Query the computer and store the fixed disks information to a variable; Return the results; The Function. Below is the function you'll use for this project, aptly named Get-FixedDisk. This project's purpose is to get the information about the non-removable or fixed disks on the target machine.

Input Checking, CodeSkulptor is a browser-based Python interpreter, as featured in the online the addition of three graphical libraries, SimpleGui, SimpleMap, and SimplePlot. We are trying to add the values into the database with the help of user input or by variables. We use the execute() method to execute the query. Then use the commit() method to save the changes you have done above.

Comments
  • Do you specifically need a simplegui solution, or are you open to other toolkits?
  • Anything works, it's just CodeSkulptor has other turorials and such like
  • @L0neGamer: I know I'm a bit late, but were you able to find the solution?
  • This question is specifically about how to do something with SimpleGui. Suggesting alternate toolkits isn't very helpful.
  • I disagree. The asker of the question might not know that other and potential better tools are avaliable. I would be happy if someone pointed me to a better tool. I use Python because it's a better tool that Windows bat files. ..
  • @Cyrex could you provide links to the documentation of both? I can't find the Tkinter one and I don't fully understand the Pyside one yet
  • Added tkinter example