|
So I'm messing around (my second day with Python, please forgive any horrible screwups thus far). The program works but I can't get the console window to stay open. It's just a lunch picker for us guys at the IT desk to replace the little box we pull from. code:
|
# ? Apr 2, 2009 17:29 |
|
|
# ? May 23, 2024 15:10 |
|
Solaron posted:My issue is that after the program runs it closes. I read that the last line should resolve that, but maybe I did it wrong, or maybe it doesn't in 3.0. Any help? I know this actually isn't anything important or hard at all, just annoying me. I did Google it and tried the few ideas there. I'm assuming this is on Windows, and that the problem is that the console window closes automatically. One workaround is to replace the last line with: code:
Edit: Though, your original code works fine on my system. It's possible pause.exe isn't part of a standard Windows installation, I probably got it from cygwin/mingw. Id4ever fucked around with this message at 18:41 on Apr 2, 2009 |
# ? Apr 2, 2009 18:36 |
|
Hm... I'm using Python 3.0, and I guess raw_input has been changed to just input. My window still closes... bugs the hell out of me. Let me try a different PC.
|
# ? Apr 2, 2009 18:50 |
|
Looks like I fixed my issue...though I don't remember how. Thanks anyway!
|
# ? Apr 3, 2009 06:43 |
|
Anybody have any experience with regex positive lookahead in python? I'm trying to reproduce what is being done here: http://www.bennadel.com/blog/1105-Ask-Ben-Breaking-An-SMS-Text-Message-Up-Into-Multiple-Parts.htm In a nutshell, splitting up a long line into 450 character maximum lines, while also taking care not to split up lines in the middle of words. If the 450 char limit is encountered in the middle of a word, the regex will backtrack to the start of the word and end the match there. This works fine in my regex tester program: But the regex mysteriously fucks up in actual python code. Here's a code fragment. code:
code:
Insidious fucked around with this message at 09:30 on Apr 3, 2009 |
# ? Apr 3, 2009 09:02 |
|
The first part is not "selected", you're effectively only finding the "latest whitespace before 450 chars"code:
EDIT: code:
dorkanoid fucked around with this message at 09:48 on Apr 3, 2009 |
# ? Apr 3, 2009 09:46 |
|
The pycon videos are up: http://pycon.blip.tv/file/1947354/
|
# ? Apr 3, 2009 12:51 |
|
tef posted:The pycon videos are up: You picked a great one to link
|
# ? Apr 3, 2009 15:09 |
|
king_kilr posted:You picked a great one to link I thought so too
|
# ? Apr 3, 2009 15:18 |
|
Awesome talk!
|
# ? Apr 3, 2009 17:16 |
|
m0nk3yz posted:I thought so too Well, in that case, allow me to pimp myself out: http://pycon.blip.tv/file/1949388/
|
# ? Apr 3, 2009 17:39 |
|
king_kilr posted:Well, in that case, allow me to pimp myself out: http://pycon.blip.tv/file/1949388/ Hay I was at that one.
|
# ? Apr 3, 2009 19:34 |
|
m0nk3yz posted:Hay I was at that one. Were you the one yelling "can't hear you" at the beginning?
|
# ? Apr 3, 2009 19:43 |
|
deimos posted:Were you the one yelling "can't hear you" at the beginning? Negative. I tend not to yell
|
# ? Apr 3, 2009 20:04 |
|
Does anyone know of a good archive for PyCon 2008 videos? There is a particular presentation I would like to watch (the Pygame one) but cannot find it. Additionally, I am starting a small Pygame project (~3 month project w/ a team of 5) and if anyone has any words of wisdom regarding Pygame or Python game development in general I would love to hear it. edit: I am particularly interested about Python 2.5.4 vs Python 2.6 with Pygame. The Pygame website suggests that Python 2.5.4 is the "best" python on windows - but that seems like a pretty weak argument and it would be nice to use 2.6. However, if that means it could lead into trouble with Pygame down the road, then I am fine sticking with 2.5. supster fucked around with this message at 08:47 on Apr 4, 2009 |
# ? Apr 4, 2009 08:34 |
|
supster posted:Does anyone know of a good archive for PyCon 2008 videos? There is a particular presentation I would like to watch (the Pygame one) but cannot find it. Before you embark on a major PyGame project, you should tale a look at pyglet. It renders with OpenGL, which is much faster than the software rendering PyGame does. If you know OpenGL, you can use it to make the graphics a lot fancier as well. Pyglet Programming Guide
|
# ? Apr 4, 2009 09:24 |
|
I saw in TV IV during the BSG finale some bingo app that was a py file running in a browser. How is this done? Beyond that what are good resources for python in web apps and can you actually run python through a browser like javascript or something?
|
# ? Apr 4, 2009 17:08 |
|
Sylink posted:I saw in TV IV during the BSG finale some bingo app that was a py file running in a browser. How is this done? There's no direct way to run Python in the browser, but PyPy can translate Python into javascript(which can be run in the browser), and IronPython can be used to run Python through silverlight, and probably something with Jython and Java applets, though I'm not sure about that.
|
# ? Apr 4, 2009 18:09 |
|
king_kilr posted:There's no direct way to run Python in the browser, but PyPy can translate Python into javascript(which can be run in the browser), and IronPython can be used to run Python through silverlight, and probably something with Jython and Java applets, though I'm not sure about that. Perhaps he saw someone using PSP or some other Python-via-Apache method that was configured to leave the .py on the end of the URL?
|
# ? Apr 4, 2009 19:51 |
|
bitprophet posted:Perhaps he saw someone using PSP or some other Python-via-Apache method that was configured to leave the .py on the end of the URL? Could be, most python deployment methods let you control the URLs anyway you want, so really you could set yourself up to have the URL end with just about anything(yes this is technically possible with any language using mod_rewrite).
|
# ? Apr 4, 2009 20:30 |
|
Scaevolus posted:Is it this http://www.youtube.com/watch?v=EGSgLuxrgYc ? I had considered Pyglet before and decided to stick with Pygame, but now you have me torn. One of the programmers knows OpenGL (not me) and the other does not (me). Is performance really that much of an issue in Pygame? We will be making some prototypes over the next few weeks, maybe we will use Pyglet for some and see how it compares.
|
# ? Apr 4, 2009 23:05 |
|
That was probably it, I was just impressed by it. Other than that, can anyone recommend a python module(s) for drawing graphics? I might want to make my own plotting module or something but I'd like something that can create graphics of any type. Am I stuck just using the tkinter canvas widget? I don't want to animate really either.
|
# ? Apr 4, 2009 23:06 |
|
supster posted:I had considered Pyglet before and decided to stick with Pygame, but now you have me torn. One of the programmers knows OpenGL (not me) and the other does not (me). Is performance really that much of an issue in Pygame? We will be making some prototypes over the next few weeks, maybe we will use Pyglet for some and see how it compares. Look through the Astraea (an Asteroids clone) game that's included in the pyglet examples. It only directly calls openGL in 15 lines, to:
None of these are really necessary, and the guy who knows OpenGL could do them easily. High ceilings are nice. Scaevolus fucked around with this message at 23:34 on Apr 4, 2009 |
# ? Apr 4, 2009 23:31 |
|
Sylink posted:That was probably it, I was just impressed by it. PyCairo works well enough, depends on what you are drawing exactly. http://cairographics.org/pycairo/
|
# ? Apr 5, 2009 00:47 |
|
So I'm pretty hosed for this one assignment I have for my Artificial Intelligence class. Ya see, I needed to fill up my schedule and this AI course was the only one that would work for me, so despite the fact that its a high level class and I'm new to my major (Computer Science, I barely have experience with C++) I am now in a predicament. I have this lovely assignment to write these two Python scripts for this MobileSim poo poo to try and make this little robot thing do some poo poo and I honestly have no clue where to even begin
|
# ? Apr 5, 2009 23:01 |
|
ukrainius maximus posted:So I'm pretty hosed for this one assignment I have for my Artificial Intelligence class. Ya see, I needed to fill up my schedule and this AI course was the only one that would work for me, so despite the fact that its a high level class and I'm new to my major (Computer Science, I barely have experience with C++) I am now in a predicament. I have this lovely assignment to write these two Python scripts for this MobileSim poo poo to try and make this little robot thing do some poo poo and I honestly have no clue where to even begin Is there another major or some poo poo you could switch to? Sorry, I mean http://www.gethomeworkhelp.com/Computer_Science_61.php.
|
# ? Apr 5, 2009 23:35 |
|
I hope this helps or whatever:code:
|
# ? Apr 6, 2009 00:56 |
|
Lonely Wolf posted:I hope this helps or whatever: Bah: code:
code:
|
# ? Apr 6, 2009 02:02 |
|
m0nk3yz posted:Bah: Hah, I assume your account has been hacked, because the real monk3yz would parallelize that to kingdom come.
|
# ? Apr 6, 2009 03:32 |
|
He's clearly simplified it, for pedagogic reasons.
|
# ? Apr 6, 2009 03:57 |
|
haha thanks for the help on a more serious note though, have any of you used this poo poo called MobileSim before? this is what's dicking my balls right now and I sort of want to kill something that's alive
|
# ? Apr 6, 2009 05:20 |
|
Can anyone explain to me what's going here? I found another solution to the problem I was trying to solve, but I would still like to better understand how Python inheritance and super() works. My goal here is to override the .x attribute of Parent in Child with a property. http://pastie.org/438066 The error message leads me to believe that super(Child, self) is not returning an instance of the Parent class (or a proxy for the Parent class or whatever) as I am expecting it to.
|
# ? Apr 6, 2009 06:27 |
|
m0nk3yz posted:
you should use stackless: code:
|
# ? Apr 6, 2009 09:27 |
|
MeramJert posted:you should use stackless: No I should write my own loving coroutine library and poo poo it all over the loving internet. That is the way of the world.
|
# ? Apr 6, 2009 13:50 |
|
supster posted:My goal here is to override the .x attribute of Parent in Child with a property. There are a couple problems here. First, when I run similar code to yours using 2.5, I get "TypeError: 'super' object has only read-only attributes (assign to .x)" in Child's x setter. I don't know a ton about objects of type super, but it appears you can't assign to one. Second, you have a more basic misunderstanding when you write "super(Child, self).x = self._x + 1". This is supposing that there is Parent's x attribute hiding on your Child object behind its x property, but that's not the case. The x property overwrites the 'x' slot on that object. Notice that we can still access a parent's methods, but that's because we look them up from the parent class' namespace, not the self object's namespace. So, even if your x setter worked, it would be recursive, and would terminate when you ran out of stack space.
|
# ? Apr 6, 2009 17:38 |
|
supster posted:Can anyone explain to me what's going here? I found another solution to the problem I was trying to solve, but I would still like to better understand how Python inheritance and super() works.
|
# ? Apr 6, 2009 17:48 |
|
Scaevolus posted:Is it this http://www.youtube.com/watch?v=EGSgLuxrgYc ? I'm almost certain that PyGame also uses hardware acceleration, because IIRC it's just a wrapper around SDL. I've used it for OpenGL-based stuff before.
|
# ? Apr 6, 2009 18:04 |
|
Janin posted:I'm almost certain that PyGame also uses hardware acceleration, because IIRC it's just a wrapper around SDL. I've used it for OpenGL-based stuff before. Last I checked, while SDL has tools to provide an OpenGL context, it does not provide any sort of hardware-accelerated support for things such as drawing, rotating, or scaling sprites. For that, you'd have to write your own OpenGL calls. Things like SDL_BlitSurface provide, IIRC, just your usual software blit.
|
# ? Apr 6, 2009 18:32 |
|
Scaevolus posted:This problem was solved on IRC. What he was really wondering about was how to make rabbyt sprites not have artifacts when rendered at float coordinates. He was trying to make the coordinates autoround to ints, but the solution was to set the rendering mode to GL_NEAREST. Benji the Blade posted:There are a couple problems here. edit: If x was a method in the base class I think I could just call Parent.x(self, value) and be fine, but because it is an attribute I can't do that. supster fucked around with this message at 20:23 on Apr 6, 2009 |
# ? Apr 6, 2009 20:13 |
|
|
# ? May 23, 2024 15:10 |
|
edit: double
|
# ? Apr 6, 2009 20:22 |