Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~17.5K People Reached
Favorite Forums
Favorite Tags
Member Avatar for FreezeBlink

A classic of early text-based interfaces... Any way to do it in Python? I tried getch(), but it doesn't really work (for instance, if you hit Enter to confirm a menu selection, and then it goes to a "press any key" thing with getch(), getch() will pick up the Enter …

Member Avatar for richieking
0
13K
Member Avatar for FreezeBlink

Really, the title says it all. Is there any way to compile all the instances of a class into a list, or other such data structure?

Member Avatar for Gribouillis
0
567
Member Avatar for FreezeBlink

Is there any easy, [i]very fast[/i] way to edit image files with Python? Any extension that Windows uses is fine.

Member Avatar for lllllIllIlllI
0
69
Member Avatar for FreezeBlink

I know, this is a stupid question, but is it possible for a class to have two variables, one of which has a value, and the other of which will [i]always[/i] hold the same value, unless the user changes it? In essence, making the second variable a duplicate of the …

Member Avatar for Gribouillis
0
113
Member Avatar for FreezeBlink

I'm currently working on an application to which sound integration is important. Currently I'm using winsound for all the sound-related aspects of the program, but it is sub-optimal. I've been unable to make it completely work, and .wav files are bulky. Are there any equally usable alternatives to winsound?

Member Avatar for lllllIllIlllI
0
78
Member Avatar for besktrap

I'm writing a gravity simulation in python and pygame, and had a quick question. Say I have an object that I can move. Lets call it "square". Then I created a line like so... [CODE] pygame.draw.line(screen, (0, 0, 0), (84, 368), (510, 368)) [/CODE] How would I tell python not …

Member Avatar for besktrap
0
111
Member Avatar for FreezeBlink

Sorry to have to post two consecutive questions for other people to help me with, but I'm having a problem with winsound that I simply can't figure out. I've checked all the documentation I could, but there's no answer. The problem is with SND_PURGE. [quote=Python Library Reference]SND_PURGE Stop playing all …

Member Avatar for Ene Uran
0
512
Member Avatar for FreezeBlink

It's always bugged me how it seems that the only way to find out where you are inside a for loop is to use a counter. For instance, suppose you want to iterate through a list, and print every entry on a second line, but for the second-to-last entry you …

Member Avatar for vegaseat
0
90
Member Avatar for FreezeBlink

I've been trying to program a "press any key to continue" function, simply because raw_input feels noobish, but so far I haven't been having much luck. I did a search and the opinions are nearly unanimous that getch() is the way to go, but...things haven't gone that well. Here's an …

Member Avatar for FreezeBlink
0
180
Member Avatar for FreezeBlink

Iterating over a list, possibly deleting elements. It's the bane of my existence. Suppose, for instance, we have a list of numbers, and want to iterate over it and delete each and every odd one. Sounds simple, right? Sorta. It's trivial, but the code you end up with is pretty …

Member Avatar for jrcagle
0
113
Member Avatar for FreezeBlink

Just noticed an odd little problem. Instead of explaining it, take a look at this IDLE run: [code]>>> ================================ RESTART ================================ >>> class test: eggs = True >>> var1 = test() >>> var2 = "text" >>> type(var2) <type 'str'> >>> type(var2) == str True >>> type(var1) <type 'instance'> >>> type(var1) …

Member Avatar for Ene Uran
0
252
Member Avatar for FreezeBlink

At various points in my text-based programs, I've had to write a function for use in multiple-choice menus. It needs to have the following qualities: [list][*]Ignores non-number input, repeating the request if it is given a string. [*]Can be given upper and lower limits on the acceptable numbers, repeating the …

Member Avatar for rikxik
0
84
Member Avatar for FreezeBlink

This is probably totally absurd, but...is it possible to, through Python, access the command line and use it? For instance, write a program that outputted all of the files in a given directory, much like cd [directory] dir would?

Member Avatar for rikxik
0
188
Member Avatar for FreezeBlink

For instance, if you have the following (random example): [code=Python]w = input("Enter width") h = input("Enter height") for x in range(0,w): for y in range(0,h): print x,y if (raw_input("Stop? y/n") == "y"): break[/code] That would only break out of the y loop. You could introduce another variable, and change the …

Member Avatar for vegaseat
0
160
Member Avatar for FreezeBlink

[quote] cell.health -= fighters[0].compDmg(fighters[0],cell) TypeError: compDmg() takes exactly 2 arguments (3 given)[/quote] Both fighters[0] and cell are object instances. How on earth does it see 3 arguments in this? I don't think wider context is needed, but just ask if it is.

Member Avatar for bvdet
0
190
Member Avatar for FreezeBlink

There's a function that repeatedly shows up in languages, usually with more or less the following form (Python syntax): [code=Python]var1 = raw_input("Input a number between one and three.") choose var1: case "1": print "You inputted one." case "2": print "You inputted two." case "3": print "You inputted three."[/code] Or something …

Member Avatar for kdoiron
0
1K
Member Avatar for FreezeBlink

Python's system of deciding for you what type to give all your variables is nice and all, but is there a way to force it to give a variable a certain data type? For instance, if you give it the following: [code=Python]n = 2 m = 3 print n/m[/code] It'll …

Member Avatar for vegaseat
0
100
Member Avatar for FreezeBlink

Recently I downloaded Ubuntu v8.04 (Hardy Heron), and was delighted to find Python pre-installed. However, that pleasant surprise was soon dampened by the fact that IDLE would not run, and so I am left without a decent program for coding in Python. gedit works, but lacks pretty much everything except …

Member Avatar for bumsfeld
0
178
Member Avatar for FreezeBlink

Hey. I'm working on a simple project that requires a way to find all the empty grid cells accessible along a path that's <= n cells long (an analogy would be TBS movement), and I've got an [i]almost[/i]-working piece of code for it. Here's the function I wrote: [code=Python]def findArea(distance,origin,gridUsed,emptyChar): …

Member Avatar for vegaseat
0
137