3

Just trying to make a simple window appear and I get this error code:

AttributeError: module 'PySimpleGUI' has no attribute 'Popup'

import PySimpleGUI as sg


sg.Popup('this is my first popup')
3
  • 1
    Did you name your own program PySimpleGUI.py, perhaps? Commented Jan 17, 2019 at 17:50
  • it is sg.popup in small letters. did you get your case wrong? Commented Oct 2, 2023 at 4:05
  • Another option is to copy download and copy PySimpleGUI.py file to the current working directory. This will work on computer where the module is not installed (by Python and Tkinter installed). Commented Oct 2, 2023 at 4:07

2 Answers 2

4

It sounds like a bad install, or you've got another PySimpleGUI.py file in your path. If you're using PyCharm, control-click the word PySimpleGUI and see where it takes you.

Can you supply info about your runtime setup? Windows/Linux? Versions (Python, PySimpleGUI), etc.

You can get the PySimpleGUI version by entering

pip show PySimpleGUI

It might be worth uninstalling and reinstalling

pip uninstall PySimpleGUI

pip install --no-cache-dir --upgrade PySimpleGUI

[EDIT]

It's often helpful to know exactly what was imported. This can be achieved by adding a print after the import.

import PySimpleGUI as sg
print(sg)

This will tell you the location of your PySimpleGUI.py file. Very handy if you're getting one from somewhere in your path, but you don't know exactly where.

Sign up to request clarification or add additional context in comments.

Comments

1

You import 'PySimpleGUI' from the place where no 'Popup'.

Probably you named your file PySimpleGUI.py (and in your file no 'Popup'). In this case rename the file...

Or it might be other file with the name PySimpleGUI.py (where no 'Popup') in the directory where your file is.

Python should open the module (where 'Popup' is present).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.