[Tutor] Building games
Hello I've been programming for a few years, mainly scripts and small applications that monitor folders and performs actions based on content of files and so on. I recently got the idea of trying to do a small game that is capable of illustrating some common problems in my field, now the game design is not the problem. I've done that, I've also gotten so far as to have windows and having some simple animations, like bouncing balls and things that react to key-presses. Now, regarding the title, building games, i need to be able to place buildings, like squares that is placed with the mouse and can be clicked and these kind of things. Can anyone recommend places to go or books to read? the books i've found so far are mostly about 2d-games like asteroids or something similar. Not quite what I was hoping, and pygame.org has alot of good sources, but outside of simply taking apart an existing game and looking at how they did it, are there any ressources to help me learn? I apologize if this is not the correct place to ask for this. Regards Tommy ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Lists
Dnia 11-06-2011 o 04:34:47 Steven D'Aprano napisał(a): Piotr Kamiński wrote: Could you please refrain from presenting your *religious* convictions in this list: the notions you believe in as well as the ones that you believe are false? This is a *technical* list, as I understand it, solely dedicated to the technical side of teaching the *Python* programming language and *programming* in general. I would like to keep it this way ... followed by FIFTY TWO lines of pseudo-philosophical waffling about his own religious beliefs. That's really funny. You made me laugh :) Piotr, I'm sorry that your religious faith is so fragile that it can't bear to be exposed to even the *existence* of contrary opinions, but that's not my problem. "followed by FIFTY TWO lines of pseudo-philosophical waffling about his own religious beliefs.(...)" I guess then that according to this line of thought the mentioned articles on Karl Popper and the Great Hunger in Ukraine - and the arguments expressed there - are too my *exclusively own* religious beliefs... The statement on the nonscientificness of (Neo)marxism must have been terribly painful to you, that you've skipped it completely and escaped forwards into ridiculing me... I think it's better to use FIFTY TWO lines of my (and other persons') arguments than to use just TWO lines of "...pseudo-philosophical waffling about his own religious beliefs" making use of no arguments supporting them, just *negating* the belief system of Christianity. Surely, Steven, "(...)your religious faith is so fragile that it can't bear to be exposed to even the *existence* of contrary opinions(...)" *supported with arguments*, without you *simply ridiculing* the adversary's factual, historical evidence and arguments. Your inner anti-Christian leftist *bigotry* and *zeal* in ridiculing and simply *spitting on* the belief system and its followers, are not my problem. Instead, I wanted to signal the inappropriateness of your behaviour and I did it. That's it. I don't have the time and willingness to keep the conversation going in your style, i.e. ridiculing the *person* of the opponent, his *beliefs* and the *arguments in favour* of them. I guess I would be definitely more successful if I had called you with an f... word or told you - more or less in this way: your constant, simplistic adversarial style (arguing *often exclusively* for the sake of arguing) is offensive, however it is I that choose not to be offended. To be clear, I'm talking of the ways that your nasty and biassed against Christianity character has been dealt with recently in the general Python list. On having this *treatment* applied to you, you usually get silent for a day or two and start to speak in a much, much meeker, less arrogant, provocative and offensive way. I realise that you need a heavy verbal thrashing, not my "fragile, laughable" factual arguments presented in a *polite*, seemingly feeble way, you "brave and always right" Internet troll and a Christianity hater. Shortly put, I am not a boor or lout, therefore I like to write longer texts with factual arguments in them, not one- or two-sentence-long, *primitive* *negations*, i.e. statements of your imaginary, unsubstantiated in any way whatsoever ideological and *moral* superiority. Why don't you, for a change, start ridiculing the Jewish or the Islamic faiths... I reckon their responses won't be so "lengthy, fragile", polite and non-violent... Stop pushing around Christianity using it as your doormat and take off your anti-Christian horse blinkers.. And it is always worth repeating (and some of you may eagerly point out my comments on the use of the word "repeatedly", I'm fine with such criticism - I criticise, so I am prepared to being exposed to criticising, and the criticising itself) : "(...)Notice that he (Karl Popper) gives reasons (the theory of *falsifiability*) why he thinks Marxist historical materialism and its idea of the progress of humanity is *unscientific*. That does not put the ideas of *"progressiveness"* of the New Left in a good light, does it? Especially when compared with Popper's views on Christianity. That must seem scary and blasphemous for leftists to distinguish the similarities between (Neo)marxism and Christianity... Thus that is why some philosophers see the varied (neo)marxist movements as denominations of the *non-traditional* Marxist *religion*, in a way similar to the diverse denominations of Christianity.(...) " Bye (that is, as it originally meant in its full form: God be with you), a biassed follower of yet another religion, a religion pretending to be a branch of science. Piotr ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Lists
"Piotr Kamiński" wrote This is a *technical* list, as I understand it, solely dedicated to the technical side of teaching the *Python* programming language and *programming* in general. I would like to keep it this way ... Since this seems to be something we can all agree on can we consider this discussion closed and get back to Python? If you wish to continue the philosophical debate please take it off list. Alan g. List moderator. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Building games
"Tommy Bell" wrote Now, regarding the title, building games, i need to be able to place buildings, like squares that is placed with the mouse and can be clicked and these kind of things. Can anyone recommend places to go or books to read? Not specifically for Python but there are many books on games programming in other languages. But it is an advanced and spacialist topic in its own right. Indeed there are entire undergraduate graduate degree level courses of 3 or 4 years duration on the subject. By all means have a go but be aware that writing a professional quality game is as much of a technical challenge as writing say, an operating system, or office application. But a general search for games programming titles should throw up some good resources: both books and web sites. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Lists
Hello, I've been told that some of you, or everybody got my e-mail four times. I'm sorry for the inconvenience. It seems there was a temporary failure of my piotr-kam[at]o2.pl mail account. I tried to send the e-mail three times, and each time got the "Undelivered Mail Returned to Sender" message. Eventually, I used the piotr.kaminski[at]poczta.onet.eu account and it got sent to the Tutor list. Piotr ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Lists
Dnia 11-06-2011 o 17:30:50 Alan Gauld napisał(a): "Piotr Kamiński" wrote This is a *technical* list, as I understand it, solely dedicated to the technical side of teaching the *Python* programming language and *programming* in general. I would like to keep it this way ... Since this seems to be something we can all agree on can we consider this discussion closed and get back to Python? If you wish to continue the philosophical debate please take it off list. Alan g. List moderator. OK. I like this style of talking - no feelings hurt, *including Christian ones as well*. Thank you. Piotr. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Building games
I think pygame would let you do a simple graphical game. On Jun 11, 2011 7:54 AM, "Tommy Bell" wrote: > Hello > > I've been programming for a few years, mainly scripts and small > applications that monitor folders and performs actions based on content > of files and so on. > > I recently got the idea of trying to do a small game that is capable of > illustrating some common problems in my field, now the game design is > not the problem. I've done that, I've also gotten so far as to have > windows and having some simple animations, like bouncing balls and > things that react to key-presses. > > Now, regarding the title, building games, i need to be able to place > buildings, like squares that is placed with the mouse and can be clicked > and these kind of things. > > Can anyone recommend places to go or books to read? the books i've found > so far are mostly about 2d-games like asteroids or something similar. > Not quite what I was hoping, and pygame.org has alot of good sources, > but outside of simply taking apart an existing game and looking at how > they did it, are there any ressources to help me learn? > > I apologize if this is not the correct place to ask for this. > > Regards > Tommy > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Building games
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/11/2011 12:32 PM, Wolf Halton wrote: > I think pygame would let you do a simple graphical game. > pygame can do plenty of complex graphics too. FWIW, you might have a better time using something like PySFML(2) or pyglet (I like pyglet much more than pygame, seems more pythonic) which wrap OpenGL instead of SDL, allowing for more stuff. Not to mention if you ever need a GUI there are a ton for OpenGL (even Qt, if you wanted). Of course, it's up to the OP. On 06/11/2011 07:34 AM, Tommy Bell wrote: > Now, regarding the title, building games, i need to be able to place > buildings, like squares that is placed with the mouse and can be > clicked and these kind of things. > In pygame/pyglet you'd want to be capturing mouse-click events and then acting on the location of the click, seeing if it's in the area of the square, etc.. Game programming is rather event-driven, similar to GUI programming. > Can anyone recommend places to go or books to read? the books i've > found so far are mostly about 2d-games like asteroids or something > similar. Not quite what I was hoping, and pygame.org has alot of good > sources, but outside of simply taking apart an existing game and > looking at how they did it, are there any ressources to help me > learn? The docs for pygame and pyglet are great, use them. Of course, reading the source of existing games is a great way to see how things are done, and is always a good learning experience. Cheers, - -- Corey Richardson -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) iQEcBAEBAgAGBQJN85uFAAoJEAFAbo/KNFvpaNoIAI0OeY7lnqdTR4AsdOdwZK0k HrZ5xuEaXVyO6UArYvVynoB6cZF+hNGiYmIiv2IO/aYLCjU0WWAvSLfLGD4zgWFR NnHdZvJ7SwfR4In4cYo2A6tkhNwHJpk2zSTgXqT07zDFvgCmyGGpTSjkHR6nWPdH jowbVm4i34K3ToPbIH1bl36+NG3OW5CynNRiOgz8bibjAtS+UrwvUFTojN3dsQ4O 9YfJ9OIXP0HMUQ71Gv4nBQFWKu6Q0qhXgTpF6JFtu9wbYiJWKj5oWNHyEdYm70Za zKeepAe9uNR2KZslQ6oB+AO2V2F2WoOoEARP6pBWmKg9lPNYCEt95HEYfe4a4MY= =ZH7D -END PGP SIGNATURE- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] STUPID telnet connection question
I think Steven and Alan misunderstood the Rayon's question. Rayon is using his telnet script to pass commands to a device ONE AT A TIME. Then he breaks the connection and reconnects for the next command.. He is asking how to open a telnet connection, pass MULTIPLE commands, then close the session. In my opinion, both of your responses border on rude. This mailing list is supposedly for beginners who often don't even know enough to formulate a clear question. If some of the more senior members ridicule the beginner's stupid questions, how will he or anyone else learn anything. If I were a shy beginning programmer, these responses would probably cause me to think twice before asking any stupid questions. Why put myself out there for ridicule? There are no stupid questions! There are only stupid teachers. - Original Message - From: "Steven D'Aprano" To: Sent: Friday, June 10, 2011 3:53 AM Subject: Re: [Tutor] telnet connection question Rayon wrote: HI All, Is there any way that I can use python telnetlib to connect to a telnet session. It would be a pretty rubbish telnet library if it didn't let you make telnet connections. I don't understand why you are asking this question, since you have successfully made connections and are complaining that they are too slow. Send commands and get back data without closing the connection. It would be a pretty rubbish telnet library if you couldn't send telnet commands. What makes you think it might not? I need the response to be faster and the login process is taking up too much time. Then get a faster link. Seriously, this is a silly question. It's like saying "I need a longer piece of string". Okay, fine. How long would you like? Why is the piece you have too short? We can't answer those questions. How are you logging in? How much time are you talking about? How fast is your link? I was thinking I could use a queue to pass in data but I am not sure how i would get it out. What data do you need to pass in, and why do you think a queue will help you? -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] STUPID telnet connection question
davidheise...@gmail.com wrote: I think Steven and Alan misunderstood the Rayon's question. Rayon is using his telnet script to pass commands to a device ONE AT A TIME. Then he breaks the connection and reconnects for the next command.. He is asking how to open a telnet connection, pass MULTIPLE commands, then close the session. Do you know this for a fact, or are you guessing? Perhaps you are right. To be honest, such an interpretation never even crossed my mind. I wouldn't have imagined that somebody who knows enough to get a telnet connection working *at all* would do this: login write(command) write(exit) login write(command) write(exit) login write(command) write(exit) instead of login write(command) write(command) write(command) write(exit) Or have I misunderstood what you are suggesting? In my opinion, both of your responses border on rude. This mailing list is supposedly for beginners who often don't even know enough to formulate a clear question. If some of the more senior members ridicule the beginner's stupid questions, how will he or anyone else learn anything. Perhaps our responses were a little brusque. But unlike others, we took the time to answer as best we could, and point Rayon towards the information we need to give a better answer. Would you rather that we just ignored him? What message does that send to Rayon? I for one would *much* prefer to be told to RTFM (or ask a better question) than to be ignored. If I were a shy beginning programmer, these responses would probably cause me to think twice before asking any stupid questions. Why put myself out there for ridicule? Good! You should think twice before asking a stupid question! Don't just fire off the first incoherent question that pops into your head. Try your best to ask a good question: rudeness goes both ways. We are all volunteers, giving our time and experience for free. If people want our help, they should do their best to ask a clear question and not waste everybody's time with contradictory, unclear questions. People will forgive a lot if it is clear that you're making an effort. There are no stupid questions! There are only stupid teachers. That is a thought-terminating cliché. Look it up on Wikipedia if you don't know what it means. Of course there are genuinely stupid questions. I've asked my share of them myself, and I'm sure I'll continue to doing so. Some stupid questions indicate ignorance, which can be fixed. Others indicate carelessness, laziness, or -- let's be honest to ourselves -- actual stupidity. Or a combination of all four. "Was it you or your brother who died in the war?", as the old joke goes. Or if you prefer a real example, I can hardly do better than to quote Charles Babbage: On two occasions I have been asked,—"Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower, House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. So please, no more with the cheesy platitude that there are no stupid questions. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Lists
On 06/11/2011 06:51 PM, Piotr Kamiński wrote: Dnia 11-06-2011 o 17:30:50 Alan Gauld napisał(a): "Piotr Kamiński" wrote This is a *technical* list, as I understand it, solely dedicated to the technical side of teaching the *Python* programming language and *programming* in general. I would like to keep it this way ... Since this seems to be something we can all agree on can we consider this discussion closed and get back to Python? If you wish to continue the philosophical debate please take it off list. Is someone listening to Bwana Gauld? Alan g. List moderator. OK. I like this style of talking - no feelings hurt, *including Christian ones as well*. Thank you. Piotr. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Kĩnũthia ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] STUPID telnet connection question
On 06/11/2011 08:02 PM, davidheise...@gmail.com wrote: I think Steven and Alan misunderstood the Rayon's question. What is 1 + 1? David I am with you. Rayon is using his telnet script to pass commands to a device ONE AT A TIME. Then he breaks the connection and reconnects for the next command.. He is asking how to open a telnet connection, pass MULTIPLE commands, then close the session. In my opinion, both of your responses border on rude. This mailing list is supposedly for beginners who often don't even know enough to formulate a clear question. If some of the more senior members ridicule the beginner's stupid questions, how will he or anyone else learn anything. If I were a shy beginning programmer, these responses would probably cause me to think twice before asking any stupid questions. Why put myself out there for ridicule? There are no stupid questions! There are only stupid teachers. - Original Message - From: "Steven D'Aprano" To: Sent: Friday, June 10, 2011 3:53 AM Subject: Re: [Tutor] telnet connection question Rayon wrote: HI All, Is there any way that I can use python telnetlib to connect to a telnet session. It would be a pretty rubbish telnet library if it didn't let you make telnet connections. I don't understand why you are asking this question, since you have successfully made connections and are complaining that they are too slow. Send commands and get back data without closing the connection. It would be a pretty rubbish telnet library if you couldn't send telnet commands. What makes you think it might not? I need the response to be faster and the login process is taking up too much time. Then get a faster link. Seriously, this is a silly question. It's like saying "I need a longer piece of string". Okay, fine. How long would you like? Why is the piece you have too short? We can't answer those questions. How are you logging in? How much time are you talking about? How fast is your link? I was thinking I could use a queue to pass in data but I am not sure how i would get it out. What data do you need to pass in, and why do you think a queue will help you? -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Kĩnũthia ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] dummy, underscore and unused local variables
Consider the following code: for i in range(mylimit): foo() running pychecker gives me a """ Local variable (i) not used """ complaint. If I use for dummy in range(mylimit): ## or for _ in range(mylimit): I get no complaint from pychecker. I would welcome comments on best practices for this issue. NOTE: I see much on google regarding unused local variables, but I would like to see comments here specifically on the use for `range' On a related note: from the python interpreter if I do >>> help(_) I get Help on bool object: class bool(int) | bool(x) -> bool .. I'd welcome comments on this as well. :) I expect to be edified is so many ways, some of them unexpected. thanks -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Saving data as jpg file
Hi, I have a Axis IP camera that I can send a HTTP command to and the data returned is the jpg image. When I get this data, I want to save it as a .jpg file, but I think my encoding is not correct, because the image is all distorted. I looked at using PIL, but the device I will install my script on can't be used to install other packages like this. I'll have to include the modules in my own folder. Here is my simple code that I started testing with. """ import urllib2 # Create an OpenerDirector with support for Basic HTTP Authentication... auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password('.', '192.168.10.190', 'root', 'pass') opener = urllib2.build_opener(auth_handler) # ...and install it globally so it can be used with urlopen. urllib2.install_opener(opener) return_object = urllib2.urlopen('http://192.168.10.190/axis-cgi/jpg/image.cgi?resolution=320 x240&squarepixel=1') html_content = return_object.read() img_file = "E:\work\img1.jpg" f = open(img_file, 'w') f.write(html_content) f.close() """ Any ideas what type of encoding I have to use if that is the problem? Thanks Johan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Lists
Alan: Thank you for all you do. I always look for your posts! You have helped me immensely with Python and I appreciate it! Jeff --- Jeff Johnson j...@dcsoftware.com Jeff --- Jeff Johnson j...@san-dc.com (623) 582-0323 www.san-dc.com On 06/11/2011 08:30 AM, Alan Gauld wrote: "Piotr Kamiński" wrote This is a *technical* list, as I understand it, solely dedicated to the technical side of teaching the *Python* programming language and *programming* in general. I would like to keep it this way ... Since this seems to be something we can all agree on can we consider this discussion closed and get back to Python? If you wish to continue the philosophical debate please take it off list. Alan g. List moderator. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] dummy, underscore and unused local variables
Tim Johnson wrote: Consider the following code: for i in range(mylimit): foo() running pychecker gives me a """ Local variable (i) not used """ complaint. If I use for dummy in range(mylimit): ## or for _ in range(mylimit): I get no complaint from pychecker. I would welcome comments on best practices for this issue. The pychecker warning is just advisory. You can ignore it if you like. But using "dummy" or "_" a variable name you don't care about is good practice, as it tells the reader that they don't need to care about that variable. On a related note: from the python interpreter if I do help(_) I get Help on bool object: This is a side-effect of a feature used in the Python interpreter. _ is used to hold the last result: >>> 1 + 1 2 >>> _ 2 >>> ['x', 3] + [None, 4] ['x', 3, None, 4] >>> _ ['x', 3, None, 4] So it's just a coincidence that when you called help(_) the previous command happened to result in True or False. If you try again now, you'll probably get something completely different. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Saving data as jpg file
Johan Geldenhuys wrote: Hi, I have a Axis IP camera that I can send a HTTP command to and the data returned is the jpg image. When I get this data, I want to save it as a .jpg file, but I think my encoding is not correct, because the image is all distorted. Are you sure that the data produced by the camera isn't already distorted? I would expect that anything you do wrong with the jpg file (such as the wrong encoding) will corrupt the file, not just distort it. But I see that you are opening the output file in text mode, and you are on Windows: img_file = "E:\work\img1.jpg" f = open(img_file, 'w') You need to open the file in binary mode, as you are writing binary data: f = open(img_file, 'wb') My guess is that this is your problem. Also, using backslashes in pathnames is tricky. You are lucky that the above works correctly, but if you move the file, it might not continue to work. Python uses backslashes to escape special characters, e.g. \n means newline. Try using this as a file name, and you will see what I mean: example = 'C:\temp\report.txt' So you need to be *very* careful of using backslashes in pathnames. The best practice is to either: * escape all the backslashes: img_file = "E:\\work\\img1.jpg" * or use forward slashes: img_file = "E:/work/img1.jpg" Windows will happily accept / instead of \ and you will save yourself a lot of grief in the future. I looked at using PIL, but the device I will install my script on can't be used to install other packages like this. I'll have to include the modules in my own folder. If you can install modules in your own folder, you could put PIL in your folder and then install it. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor