No rectangle shown in pygame [duplicate] - python

This question already has answers here:
Problems getting pygame to show anything but a blank screen on Macos
(10 answers)
Closed 2 years ago.
Just started programming in python and pygames.
Whenever I try running a py file with pygames, the pygames window will appear, but there will be absolutely nothing in it. No errors in the log, but nothing shows, it's just a gray screen.
I tried running it on IDLE, and through the command line (I'm on a mac so I use the terminal)
And it's not just my programs that aren't showing anything, I've tried to run one of pygames examples, and it will still not display anything. For example, if I run the pygames alien example, the window will appear with a blank gray background. I'll hear the audio for the program, but no display.
Anything would help, I'm at a loss especially since no errors are showing in the log.
EDIT1:
I'm using Python 3 (and I really need to keep using Python 3)
EDIT2:
I'm using python 3.7. pygames version 1.9.4. The examples are with the pygames, they were downloaded together, so I assume it's for that version.
EDIT3:
ok, my OS is Mojave 10.14. I've tried starting the application by: opening the file, running it on IDLE, and running it through the command line, none have worked. python2 is installed, but when I run the pygame it's a python3 file

Known issue with Mojave - see their issue tracking: https://github.com/pygame/pygame/issues/555

You can also install new pygame using pip install pygame=2.0.0.dev6. This
worked in my case.

Related

Python 3.10 IDLE does not respond everytime I hit configure IDLE from options

I am a Windows 10 user, and had configured the Python 3.10 IDLE to dark mode and had added the Fira Code font to the IDLE a few days back (Through the Options menu). Then the Python IDLE was working fine; without issues.
However, each time after that when I try to go to 'Configure IDLE' from Options Menu, Python IDLE just freezes and then stops responding, until I manually close it. It then asks to run a Windows check and reports the error to Windows. I have tried uninstalling and reinstalling Python; however that did not work.
Image: Python has stopped responding (happens everytime I click on configure IDLE)
I am a Windows user and tried running python from cmd using the command: py -m idlelib to start IDLE from the command line to try and get an error report, however the same problem happens as mentioned above, and I do not get an error report when I close Python. I tried finding solutions in similar questions, however I did not understand what was going on. I also do not seem to figure out how 'running the Python IDLE' through the command line works, other than running it using the above command. Can someone please assist me on what to do next at this point, that would be of huge help :D
Try uninstalling the font. The Doesn't work part of the Editor compatibility list on https://github.com/tonsky/FiraCode includes IDLE. I suspect that the font is incompatible with tcl/tk. Your report is similar to
IDLE Settings window won't appear
See https://bugs.python.org/issue45103 for so far futile efforts to protect IDLE.
UPDATE: We were not able to reproduce the problem with FireCode. However, the BPO issue referenced above lead to a tcl/tk bug report that lead to a bugfix, at least for the Phaistos font, that is included in tcl/tk 8.6.12. This is included in the new Python 3.9.9 Windows installer and will be in the upcoming 3.10.1 installer. It might fix your issue with FiraCode.

Pycharm not importing standard library [duplicate]

This question already has answers here:
Difference Between Python's IDLE and its command line
(4 answers)
Closed 1 year ago.
But they work just fine in IDLE. For example,
import time
time.asctime()
works fine in IDLE, but is not working in Pycharm.
I have tried changing the interpreter but still doesn't work. Other packages that I installed myself from cmd like numpy are working fine.
Any help will be appreciated
EDIT : When I add the package time by pressing + in the interpreter settings, it says
ERROR: Could not find a version that satisfies the requirement time
If you get no error message, and you have shown us your whole program then your problem is that you are expecting time.asctime() on its own to produce output the way it does in IDLE.
But to get the same effect in a program that PyCharm runs, you need something like print(time.asctime()).
To get PyCharm to do what IDLE does in this case, you need to ask PyCharm to open a Python console.

Clearing the screen of IDLE interactive mode [duplicate]

This question already has answers here:
Any way to clear python's IDLE window?
(23 answers)
Closed 2 years ago.
Can I clear the screen of IDLE interactive mode in Windows? I tried with the following code which fails to work:
import os
os.system('cls')
The cls command works only in Windows terminal(command prompt) and it doesn't work in IDLE screen.
Is there any other way? Or first of all, is there any hope to clear that IDLE interactive mode???
cls and clear are commands which will clear a terminal (ie a DOS prompt, or terminal window). If you are using the shell within IDLE, which won't be affected by such things, a workaround might be to print a lot of empty lines with print("\n" * 100). See also this answer for more information.
No, it is not possible, neither in IDLE, nor in Python command prompt.
Use IPython instead with its “magic” command %cls (and many others), preferable as a part of some IDE which utilized it, for example Spyder, PyCharm or JupyterLab.
Anaconda contains both Spyder and JupyterLab and many Python packages, it's probably the best all-in-one solution.
You can from os import system and then system("cls")
this will just clear out the screen. have fun coding:).

No Windows popping up while using pygame

I have been using pycharm in my mac but while importing pygame, there is no window popping up. I have copied some codes from google about pygames but it is also not working. I think there might some settings problem in mac os because in my pc the code is working perfectly. Another information is that no error is showing, which means no problem with code or interpreter.
For me, and other people, Python 3.8 doesn't work with PyGame for some reason. Try using Python 3.7.
I am also using PyCharm...
I found, as a workaround, on Apple,
if your "Force Quit" the running Python in the Dock,
and then try to run it again you get:
Whichever one your choose, it then continues and displays the window.

Python 2.7.5 IDLE GUI wont open

I have been having a problem with Python lately, I closed a .py file while working with Python Turtle in V2.7.5 of Python and ever since I can't open the Python IDLE. I've tried everything I can think of... Un-installing and re-installing, opening it from inside the idlelib and I just can't get it right so can someone please explain what's going on because I've tried everything.
OS: Windows 7 64-bit
Instead of using Python's IDLE im using notepad++ and it works fine

Categories

Resources