No Windows popping up while using pygame - python

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.

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.

PyGame snake game not running in PyCharm

I am trying to run a python file for a snake game in PyCharm (Community Edition 2020.2). I am using Python 3.8. When I try to run the file, the Python application tries to open, but is never able to to start the game. I feel like there is something wrong with my interpreter. I used the "which python3" command to figure out where my Python3 was installed and am using that location for my interpreter, but again, the application doesn't open upon running. I have attached a screenshot of my interpreter. Any thoughts on what might be wrong would be great
PyCharm automatically creates a virtual env for your work. That might be the root of your problem. You could look up about that to resolve your problem. I am a bit less familar with virtual-envs. Someone else could give you detailed info but it might be the gist.

How can I open pygame windows outside of PyCharm?

I made a game in pygame. It works perfectly fine when run from pycharm. However, when I want to run it from another location, say command prompt or just windows explorer, all that I get is a black screen that briefly pops up before closing.
I have had the same problems when writing code that uses selenium or other imports. I'm quite sure that the imports are the problem. Code without imports works just fine, regardless from where it's run.
I'm sorry if this is a stupid question with an obvious answer, I'm still a beginner.
Thank you in advance, noble people of StackOverflow.
Try to run this command in cmd (outside the environment):
pip install pygame
Mine works fine and, yes, it is a problem related to the imports.

IDLE 3.4.3 crashes when running module

I've recently started to use Python, and I don't know much about programming.
I've installed Python 3.4.3 in my Mac OS X Yosemite, and it worked fine for a few months, but now every time I want to run a module it stops responding.
so I use IDLE and when I open a new file to define a function I can write, then I click run and I save my file, and then when I click save IDLE doesn't restart as it use to and I can't write on it or do anything else. there is no crash report, no nothing, just all frozen. I close it and if then I re open and write on IDLE it works but as soon as I try to run a new file again it freezes.
How can I solve it?
to try stuff out i've been using repl.it online and it is useful for a learner like me but still I would like to be able to use IDLE on my mac.
THANK YOU FOR YOUR HELP!!!!
Try using Anaconda, which is another Python distribution, but more science-oriented. It has all the commonly required modules already in it (plus other for scientific purposes), so that you don't have to install them as and when required. And when you install Anaconda, it automatically installs Spyder, which is a much better IDE than IDLE.

wxPython window immediately crashes/closes with Komodo on Mac

I'm completely new to coding and am trying to get my feet wet at the moment. I've installed Komodo Edit on my Mac and it works fine with Python 2.7 and 3.3.
I now want to use wxPython (with Python 2.7), which I installed. Through a YouTube tutorial I got the following
import wx
app=wx.App()
win=wx.Frame(None)
win.Show()
app.MainLoop
to simply see if it's working correctly. It should just open a small window with nothing in it.
When running that with Komodo the window shows up for a split-second and then disappears. When running the same thing in the Terminal the window appears but it crashes (beachball). The same error happens without the app.MainLoop at the end as well in Komodo.
As said before, I'm completely new to this and can't find the error on the internet. Is this a known error? I would love to get it to work with Komodo since my experience with it was quite pleasant for my needs.
Thank you very much!
Oliver
Look at your example source and try again.
Spoiler Alert
app.MainLoop() # !, with parentheses
EDIT: It still crashes, post the output of the following (on a bash or whatsoever on your linux)
yourshell> python
Which version of Python does it print?
On the python prompt:
...
>>> import wx
>>> print wx.__version__
Do you get the version of python you expect?
We assume that your example lives in a file test.py in the directory you were in when starting python.
>>> import test
The empty window should show up now.

Categories

Resources