Re: Defining a Python enum in a C extension - am I doing this right?
On Fri, Jul 30, 2021 at 2:41 PM Serhiy Storchaka wrote: > > 23.07.21 11:20, Bartosz Golaszewski пише: > > I'm working on a Python C extension and I would like to expose a > > custom enum (as in: a class inheriting from enum.Enum) that would be > > entirely defined in C. > > I think that it would be much easier to define it in Python, and then > either import a Python module in your C code, or exec a Python code as a > string. > You mean: evaluate a string like this: ''' import enum class FooBar(enum.Enum): FOO = 1 BAR = 2 BAZ = 3 ''' And then pull in the FooBar type from the resulting dictionary into my C code? Sounds good actually. I think I'll be able to add the FooBar type to another type's tp_dict too - because some enums I want to create will be nested in other classes. Bart -- https://mail.python.org/mailman/listinfo/python-list
'Pygame Module' not working
Hi, I am a beginner in Python and I have started with the 'Pygame' module. I was making a 'Flappy Bird' game with the module with the help of Youtube videos. I was able to create a blank window. I had downloaded the game assets in my computer in a folder called 'Python' and in a subfolder called 'assets'. I tried to upload the Flappy Bird picture and other sprites with the code - pygame.image.load('assets/Flappy Bird.png') However, when I ran the script it was showing an error message - File not found Please advise me on how to upload the sprites and where I was going wrong. Thank You, Regards -- https://mail.python.org/mailman/listinfo/python-list
Scraping Shopify Stores - With Python [example included inside]
There is a chrome extension that shows live sales of websites that are built on the shopify ip. For example, in the image below, there is a pretty popular store- gymshark, which is built on shopify.. and every minute they get a sale it shows here on the extension: http://i.prntscr.com/K2lb1yS-QyqB1oYmHqV4yQ.png Any of you know how to get this information? Probably anytime that there is a sale the customer is redirected to a thank you page, and every time it happens it might ping a sale notification here but how can we extract that information -- https://mail.python.org/mailman/listinfo/python-list
Re: 'Pygame Module' not working
On Sat, 31 Jul 2021 14:07:05 +0530, 37_VA_VEER CHAKRABORTY declaimed the following: >pygame.image.load('assets/Flappy Bird.png') >However, when I ran the script it was showing an error message - File not >found >Please advise me on how to upload the sprites and where I was going wrong. First attempt: use a full pathname. Second: determine what the "current working directory" is in which your program is running, then use a pathname relative to that directory. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: 'Pygame Module' not working
On 31/07/2021 03.37, 37_VA_VEER CHAKRABORTY wrote: Hi, I am a beginner in Python and I have started with the 'Pygame' module. I was making a 'Flappy Bird' game with the module with the help of Youtube videos. I was able to create a blank window. I had downloaded the game assets in my computer in a folder called 'Python' and in a subfolder called 'assets'. I tried to upload the Flappy Bird picture and other sprites with the code - pygame.image.load('assets/Flappy Bird.png') However, when I ran the script it was showing an error message - File not found Are you running your program in the parent directory of "assets"? What happens when you go into the python interpreter (REPL) and import pygame followed by executing that function? -- Michael F. Stemper Why doesn't anybody care about apathy? -- https://mail.python.org/mailman/listinfo/python-list
Re: 'Pygame Module' not working
On 2021-07-31 20:46, Dennis Lee Bieber wrote: On Sat, 31 Jul 2021 14:07:05 +0530, 37_VA_VEER CHAKRABORTY declaimed the following: pygame.image.load('assets/Flappy Bird.png') However, when I ran the script it was showing an error message - File not found Please advise me on how to upload the sprites and where I was going wrong. First attempt: use a full pathname. Second: determine what the "current working directory" is in which your program is running, then use a pathname relative to that directory. The path of the program itself should be in __file__. You can then use os.path.dirname to get the path of its folder and os.path.join to build a path from that to the image file. -- https://mail.python.org/mailman/listinfo/python-list