|
Is there something decent as a 2d game library these days? There's a ton of abandoned half-finished libraries. What I know about so far: pygame - The classic but not hardware accelerated and barely maintained these days pyglet - Basic core functions but everything graphic wise is done with your own OpenGL calls. cocos2d - Nice, quick and multi platform, full of great stuff but the documentation is almost non-existent for the python edition, just about everything I've been able to find is for the iOS version. If I could find a decent resource for it I'd use it in a heartbeat. ahmeni fucked around with this message at 10:54 on Jul 25, 2013 |
# ? Jul 25, 2013 10:52 |
|
|
# ? May 24, 2024 14:22 |
|
ahmeni posted:Is there something decent as a 2d game library these days? There's a ton of abandoned half-finished libraries. What I know about so far: With Apple introducing it's own 2d game framework for iOS, cocos2d for iOS is all but dead. I know they had a big push to make javascript it's primary focus, so maybe that will keep it around, and the tutorials may all start switching to JS...
|
# ? Jul 25, 2013 17:57 |
|
What is the best Python IDE for Linux? Should I stick with VIM? It does give me an excuse to be an elitist
|
# ? Jul 25, 2013 18:01 |
|
QPZIL posted:What is the best Python IDE for Linux? Should I stick with VIM? It does give me an excuse to be an elitist I don't know about "best" because that's subjective, but I really like PyCharm.
|
# ? Jul 25, 2013 19:06 |
|
QPZIL posted:What is the best Python IDE for Linux? Should I stick with VIM? It does give me an excuse to be an elitist Vim is really good if you've already set it all up. A lot of people really like PyCharm, it's free for open source projects and classrooms but costs money otherwise. I've heard NetBeans can be pretty great, too. IDLE is generally not very good. As far as features go, Vim provides more than most IDEs while still being free. Obviously you should avoid Emacs. I've been meaning to give PyCharm a try despite being a Vim user myself, maybe you should give it a shot. The only thing holding me back is that most of my development is for commercial purposes, I just need to find the right open source project and then I'm totally going to try it.
|
# ? Jul 25, 2013 19:28 |
|
Eclipse + PyDev works fairly well despite being kinda bloated and clunky.
|
# ? Jul 25, 2013 20:13 |
|
vim can be made into a pretty fully features IDE for python, should you so desire (and are already invested in vim). Theres stuff like https://github.com/klen/python-mode, https://github.com/Valloric/YouCompleteMe. and https://github.com/ivanov/vim-ipython. For more information, ask me about my vimrc
coaxmetal fucked around with this message at 20:29 on Jul 25, 2013 |
# ? Jul 25, 2013 20:27 |
|
Using lxml, foo.text_content() will return plain text contained within a particular level, but it strips out all HTML tags. How can I get the raw HTML contained within a particular level? For example, how do I get all the content between <div class='dummy'> and </div> not just "the quick brown fox"? (This is probably stupidly easy, but I'm not seeing it....)code:
onionradish fucked around with this message at 21:43 on Jul 25, 2013 |
# ? Jul 25, 2013 21:34 |
|
Ronald Raiden posted:vim can be made into a pretty fully features IDE for python, should you so desire (and are already invested in vim). Theres stuff like https://github.com/klen/python-mode, https://github.com/Valloric/YouCompleteMe. and https://github.com/ivanov/vim-ipython. For more information, ask me about my vimrc I'd love to see your python-enabled vimrc
|
# ? Jul 25, 2013 22:07 |
|
So I just had a fun time. I spent a lot of time in the past making a script take data files I feed it, and make (mostly) any graph I want. Then... I got greedy. I saw matplotlib had had a few updates since my version (1.1.0). So like an idiot, I did a quick cursory check of the changelog, saw nothing crippling to my codes, and installed it. Now every time I run my plotting programs, they terminate with segmentation faults with no tracebacks. I've scorched Earth my matplotlib libraries, and hope to god that reinstalling the old 1.1.0 will fix it. I just don't understand what could possibly be in my codes to cause such a disastrous error. JetsGuy fucked around with this message at 22:30 on Jul 25, 2013 |
# ? Jul 25, 2013 22:24 |
|
QuarkJets posted:I'd love to see your python-enabled vimrc https://github.com/coaxmetal/dotfiles/blob/master/.vimrc . Probably not necessarily a great drop in, but the packages that work with python and some of the settings should be easily portable.
|
# ? Jul 25, 2013 22:35 |
|
JetsGuy posted:So I just had a fun time. Ok, something is horribly wrong. Reverting back gives some of the same problems. Segfaults, or this message (which I also got from the new matplotlib): code:
|
# ? Jul 25, 2013 22:58 |
|
pyCharms is pretty slick, thanks for that! It beats juggling 2/3 terminal windows to code Python/Django. Now I just have to come up with a legit app that I can announce online so I can get an open-source license
|
# ? Jul 25, 2013 23:12 |
|
They'll give out an open source license for any silly little open source project you put out there. They gave me a license for a crappy open source hard drive benchmark I wrote several years ago. The only thing to be aware of is that you're not allowed to develop commercial software using the open source license.
|
# ? Jul 26, 2013 01:19 |
|
QuarkJets posted:I'd love to see your python-enabled vimrc http://sontek.net/blog/detail/turning-vim-into-a-modern-python-ide Any time I need to set up vim again, I just use this guide.
|
# ? Jul 26, 2013 12:52 |
|
ahmeni posted:Is there something decent as a 2d game library these days? There's a ton of abandoned half-finished libraries. What I know about so far: Seconding this, been looking into it for awhile now.
|
# ? Jul 26, 2013 14:34 |
|
This may be more of a sampling/frequency analysis or math question, but I'm having trouble with FFT precision on an instrument tuner I'm working on. I'm seeing fundamental frequency results (in hz) only in increments equal to sample rate/sample size. For example, With a 44100hz rate and 1024 size, the only possible results I see are multiples of 43.1hz. If I use a 44100hz rate and 44100hz size, the precision is 1hz (44100 / 44100). I don't have a strong grasp on how Numpy/Scipy FFT, or FFT works in general, but I don't think this limitation should be occurring. I plotted a size-1024 sample of a 440hz tone in matplotlib, moused over the peaks, and recorded the number of samples between 5 peaks. It equaled 501.24. Division by 5 gives 100.25 samples per cycle. Dividing this by the sample rate of 44100hz, and inversing this gives a result of 440hz, the correct answer. The FFT shows 430.67hz, due to the precision problem. Condensed code: Python code:
Dominoes fucked around with this message at 15:22 on Jul 26, 2013 |
# ? Jul 26, 2013 15:16 |
|
Your lowest frequency will be determined by the length of the sample. I believe if your sample is 1s long, the lowest frequency will be 1Hz (I'm not super sure on the math for this, but I bet it's that if you have a 0.5Hz signal you could represent that over the 1s range by using the higher frequencies -- basically by aliasing). So the frequencies represented by a DFT will be limited to multiples of your entire sample size (up to the sample rate / 2). I'm sure you're used to being only able to represent a finite amount of numbers with a floating point decimal -- the same thing is happening here; you can only represent a certain amount of frequencies with a DFT, and the range of frequencies is defined by your sample size and sampling rate. If this seems weird, just remember that you're passing in a vector of some length that represents the time series, and getting another vector of equal length that represents the frequency content. If the first vector is small, the second one will be small too, and it'll have fewer frequencies in it. If the first one is large, the second one will also be large. You can make the vectors larger by increasing the time (expanding low frequencies) or by increasing the sampling rate (expanding high frequencies) or both. Also remember that your entire signal is perfectly represented by the DFT components (reverse DFT yields the original signal with perfect fidelity, ignoring machine precision). It's not that frequencies get "lost" if your sample is too short, it's that they technically weren't even there (the same values can be represented with higher frequencies).
|
# ? Jul 26, 2013 15:53 |
|
Emacs Headroom posted:Your lowest frequency will be determined by the length of the sample. I believe if your sample is 1s long, the lowest frequency will be 1Hz (I'm not super sure on the math for this, but I bet it's that if you have a 0.5Hz signal you could represent that over the 1s range by using the higher frequencies -- basically by aliasing).
|
# ? Jul 26, 2013 21:23 |
|
They're probably doing something smarter than looking for the biggest Fourier component (e.g. the Multitaper method). edit: If you want to do it the simple way, take overlapping windows (that is, update every 100ms or whatever, but still take the last 500ms or the last 300ms or what have you -- you might have to make a little buffer for this). Then get the power spectrum for the whole buffered window (that is, the squared Fourier components), and take the dominant component(s). Make sure you use a sensible window function (Blackman, Hamming, etc.) when you get the power spectrum. This should be workable and relatively responsive if you're making a guitar tuner or something Emacs Headroom fucked around with this message at 23:15 on Jul 26, 2013 |
# ? Jul 26, 2013 23:07 |
|
Beamed posted:Seconding this, been looking into it for awhile now. I've looked at just about everything available in the last few days and there just doesn't seem to be anything else of note. Time to either figure out cocos2d or learn OpenGL for pyglet, I guess.
|
# ? Jul 27, 2013 02:11 |
|
Emacs Headroom posted:They're probably doing something smarter than looking for the biggest Fourier component (e.g. the Multitaper method). Also if you're just trying to find the frequency of a single sinusoid with Gaussian noise you don't have to calculate the spectrum at all.
|
# ? Jul 27, 2013 02:36 |
|
So this no doubt belongs in the stupid thread, but I'm new and I figure you folks might be able to point out some other mistakes I may be making. Basically, this all works how I want except when I press enter in the first field, it doesn't display the result. But it works in the second field. http://pastebin.com/rTrJJLa6
|
# ? Jul 27, 2013 04:53 |
|
Dominoes posted:Thank you for the detailed, clear explanation. I'll try to figure out a solution working around this. The main problem it introduces is low (ie 1fps if looking for 1hz precision) update rates. I'm using a Qt Timer, which supposedly creates new threads, but it's still somehow refusing to run more frequently than the sample time. Maybe a more explicit multithreading approach is required. I'm also a little thrown, since Lingot, another tuner, (coded in mountains of C++) uses low sample sizes (512 - 2048), and a 44100hz sample rate, but has good precision. What's the highest frequency you're trying to measure? What kind of signal are you dealing with? Are you filtering your signal before sampling to prevent aliasing?
|
# ? Jul 27, 2013 06:05 |
|
Emacs Headroom posted:They're probably doing something smarter than looking for the biggest Fourier component (e.g. the Multitaper method). fritz posted:Also if you're just trying to find the frequency of a single sinusoid with Gaussian noise you don't have to calculate the spectrum at all. BeefofAges posted:What's the highest frequency you're trying to measure? What kind of signal are you dealing with? Are you filtering your signal before sampling to prevent aliasing? Dominoes fucked around with this message at 19:05 on Jul 27, 2013 |
# ? Jul 27, 2013 18:47 |
|
I'm using pywin32 to do some GUI automation on Windows. I've noticed that if I call a win32 function and get a zero return code, python will print a message to stderr and halt the script. This seems to handled by the pwin32 library. How can I prevent this? Right now I'm running in IDLE and I need to keep checking in on the script to see if it's stalled, ideally I would need to let it run for hours at a time unsupervised.
|
# ? Jul 29, 2013 12:57 |
|
Suggestions for pleasant and relatively maintained python frameworks for games and graphics? Is there much out there for Python 3? I've looked at pygame and pyglet (and the latter seems to be more in use), but I'm wondering if anyone else has good ideas
|
# ? Jul 29, 2013 14:15 |
|
the wizards beard posted:I'm using pywin32 to do some GUI automation on Windows. I've noticed that if I call a win32 function and get a zero return code, python will print a message to stderr and halt the script. This seems to handled by the pwin32 library. How can I prevent this? Right now I'm running in IDLE and I need to keep checking in on the script to see if it's stalled, ideally I would need to let it run for hours at a time unsupervised. I'm on my phone so I can't type a lot of detail, but every time I've wanted to do something like this, I end up using AutoIT and it's COM bindings with Python. If you need help with it, I've answered questions about it on StackOverflow that you should be able to find with some Googling.
|
# ? Jul 29, 2013 16:53 |
|
Take a look at pywinauto, sikuli, or swapy.
|
# ? Jul 29, 2013 17:03 |
|
Thermopyle posted:I'm on my phone so I can't type a lot of detail, but every time I've wanted to do something like this, I end up using AutoIT and it's COM bindings with Python. Thanks, I ended up implementing all the mouse-moving and keyboard entry parts just by using win32 functions, so I'd like to avoid starting over if possible. Things have been running for 7 hours without issue today, I just would just like to handle any possible error conditions so that the script could email me if it runs into problems. Unfortunately this "halt-on-writing-to-stderr" thing is preventing that from working. e: BeefofAges posted:Take a look at pywinauto, sikuli, or swapy. I tried a pywinauto and swapy combo initially, it turned out the program I'm trying to automate doesn't use standard Windows controls and menus to build a GUI, it just has a large bitmap that it draws GUI elements on. pywinauto seems to prefer working with named controls. the wizards beard fucked around with this message at 17:08 on Jul 29, 2013 |
# ? Jul 29, 2013 17:05 |
|
the wizards beard posted:I tried a pywinauto and swapy combo initially, it turned out the program I'm trying to automate doesn't use standard Windows controls and menus to build a GUI, it just has a large bitmap that it draws GUI elements on. pywinauto seems to prefer working with named controls. Oh, that's really annoying. Can you show us some sample code and output so we can see what you're talking about?
|
# ? Jul 29, 2013 17:10 |
|
BeefofAges posted:Oh, that's really annoying. Can you show us some sample code and output so we can see what you're talking about? Yeah it's a bit of a pain. Unfortunately the only copy of the code is on the system that's running an automated job right now (), but I'm basically just grabbing handles to windows and using SetCursorPos to move the mouse to XY co-ordinates within that window. The win32 libraries have enough functions exposed to do this without too much trouble, it's just that pywin32 is printing error messages whenever a win32 function returns zero and that's halting things for me.
|
# ? Jul 29, 2013 17:16 |
|
What exact error are you getting?
|
# ? Jul 29, 2013 17:55 |
|
Lumpy posted:With Apple introducing it's own 2d game framework for iOS, cocos2d for iOS is all but dead. I know they had a big push to make javascript it's primary focus, so maybe that will keep it around, and the tutorials may all start switching to JS... That I doubt. Cocos2d for ios has the lionshare of the market, is conceptually multiplatform via cocos2s-x and its html5 spin-off and has zynga as the 700lb gorilla backing it. Apple could make a big impact by bringing scene kit across to the ipad which would pull the rug out from cocos2d feet by delivering proper 3d, (There is cocos3d but its a bit of a mess and doesnt support shaders making it pretty ancient and lovely), but at the moment gamekit is the minority platform for the iphone right now. Its not widely used, hasn't the tooling cocos2d has, nor is it as capable. Or as easy actually. Cocos2d python is very nice by the way. duck monster fucked around with this message at 19:39 on Jul 29, 2013 |
# ? Jul 29, 2013 19:37 |
|
tef posted:Suggestions for pleasant and relatively maintained python frameworks for games and graphics? pyglet is a very, very thin wrapper around OpenGL. pygame is a very, very thin wrapper around SDL. Both of them are in maintenance hell. If you find bugs in either (and I have, and you will probably will too), they ain't getting fixed. I've given up on using Python for game development, and switched over to JS and <canvas>/WebGL, and I'm doing a lot better.
|
# ? Jul 29, 2013 19:51 |
|
Suspicious Dish posted:pyglet is a very, very thin wrapper around OpenGL. pygame is a very, very thin wrapper around SDL. This is a real shame. I like programming in a lot of languages but I have the most fun writing python, and if I'm writing a game I want to have lots of fun!
|
# ? Jul 29, 2013 20:16 |
|
Thermopyle posted:This is a real shame. I like programming in a lot of languages but I have the most fun writing python, and if I'm writing a game I want to have lots of fun! I'm sure it's possible, after all, Civ 4 had a lot of python in it. It's just that you probably would have to make your own library in order to actually do anything cool with it.
|
# ? Jul 29, 2013 20:56 |
|
Thermopyle posted:This is a real shame. I like programming in a lot of languages but I have the most fun writing python, and if I'm writing a game I want to have lots of fun! I actually recommend you check out JS. For all you may have heard otherwise, it's actually fairly Python-like and I often feel like I'm writing Python in JavaScript. That said, I tend to use Mozilla JS in most of my projects which gives me fun stuff like destructuring assignment, let, and list comprehensions / generator expressions: JavaScript code:
|
# ? Jul 29, 2013 21:59 |
|
Suspicious Dish posted:I actually recommend you check out JS. For all you may have heard otherwise, it's actually fairly Python-like and I often feel like I'm writing Python in JavaScript. You know, JS is one of those things that I've only ever dabbled in because I'm forced to use it and thus I resented it on some level. I need to just write a project in it to get used to it...
|
# ? Jul 29, 2013 22:09 |
|
|
# ? May 24, 2024 14:22 |
|
What is it about writing a game engine that causes so many burnouts and poorly maintained hellscapes of source code?
|
# ? Jul 30, 2013 06:49 |