Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with PySimpleGui
#1
Tried to install the PySimpleGui and failed miserably.
First I ran the following code that I copied from the Cookbook
import PySimpleGUI as sg      

layout = [[sg.Text('My one-shot window.')],      
                 [sg.InputText()],      
                 [sg.Submit(), sg.Cancel()]]      

window = sg.Window('Window Title', layout)    

event, values = window.Read()    
window.Close()

text_input = values[0]    
print(text_input)
Running this gave me the following error message
Error:
>>> = RESTART: D:/EDEM626/Assignment 2/Databases/Python Version/Create Tables.py = Traceback (most recent call last): File "D:/EDEM626/Assignment 2/Databases/Python Version/Create Tables.py", line 1, in <module> import PySimpleGUI as sg ImportError: No module named 'PySimpleGUI'
After this I tried to instal PySimpleGui. The Cookbook gave me the code but no instructions as to where to put it. I tried it on the command line as follows
>>> pip install --upgrade PySimpleGUI
This gave me the following errormessage
Error:
SyntaxError: invalid syntax
Any help would be appreciated
Reply
#2
>>> indicates you are in python interactive mode.
you should run pip command from cmd|command prompt|terminal, e.g.
c:\>pip install --upgrade PySimpleGUI
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
The pip install command gets ran into your system prompt, not the python prompt. So based on the fact that you tried to upgrade the package in your python prompt, you probably never installed it in the first place to begin with. Run the install command in your cmd prompt

As a side note, not many people use PySimpleGUI. So any issues you have with the actual module . You would have more options with actually just using tkinter, WxPython, etc.
Recommended Tutorials:
Reply
#4
Thanks guys for your efforts. Neither the windows command prompt or the Python command prompt would accept the pip install command, so I will take your advice and stick to tkinter - which I know already
Reply
#5
(Aug-13-2019, 02:08 PM)apowell Wrote: Neither the windows command prompt ... would accept the pip install command
Obviously you are doing something wrong or your installation is not OK and it's good to understand what because pip is the way to install external packages. And you will have to install external packages a lot...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#6
(Aug-13-2019, 02:08 PM)apowell Wrote: Neither the windows command prompt or the Python command prompt would accept the pip install command,
A common mistake is that Python is not in Windows Path.
Here how it should work,this is from command line(cmd).
# Test pip
C:\>pip -V
pip 19.2.1 from c:\python37\lib\site-packages\pip (python 3.7)

# Install
C:\>pip install --upgrade PySimpleGUI
Collecting PySimpleGUI
  Downloading ... 
Installing collected packages: PySimpleGUI
Successfully installed PySimpleGUI-4.1.0

# Test that it work
C:\>python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySimpleGUI
>>> PySimpleGUI.version
'4.1.0 RELEASED - Anniversary Edition'
>>> exit()

C:\>
All info is in ink under if want to install new version or add exciting Python to Path(also i mean Windows Environment Variables Path) see image in link.
Python 3.6/3.7 and pip installation under Windows
Reply
#7
EVen if you abort using PySimpleGUI and already have tkinter...I would figure out what you are doing wrong with pip installs because that is used any time you want another 3rd party library. If you dont figure it out now, then your just delaying it until later.
Recommended Tutorials:
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020