Forum: Python Oct 15th, 2009 |
| Replies: 4 Views: 218 Do you mean something like this??
numarray = [1,2,-3,4,5,-25]
for n in numarray:
print "The inverse of", num, "is", num * -1
#print("The inverse of", num, "is", num*-1)
# use the... |
Forum: Python Sep 29th, 2009 |
| Replies: 22 Views: 965 Not really, because in MS Windows the 'Program Files' folder is the system default folder for programs to be installed in (and there are usually a lot of programs installed there!).
Simply... |
Forum: Python Sep 29th, 2009 |
| Replies: 22 Views: 965 Dammit...I thought I'd tried that combination of string in string earlier..... Obviously that was one permutation I missed!
Hang on....Looking back at my failed scripts from when I was playing... |
Forum: Python Sep 29th, 2009 |
| Replies: 22 Views: 965 I've just done a bit of digging around on python.org and found this:
http://bugs.python.org/issue1524
Looks like I'm not the first person to come up with this workaround....See the post made by... |
Forum: Python Sep 29th, 2009 |
| Replies: 22 Views: 965 It took a bit of playing around, but think I've found a workaround for this....
I noticed in the docs for os.system() (Yes I RTFM!) it mentions that the subprocess.call() should be used instead.... |
Forum: Python Sep 28th, 2009 |
| Replies: 1 Views: 346 OK, I know it's been a while since I originally posted this and I've marked the thread as solved, but this is a valid bug in wxPython....So here's a quick update!
I finally managed to get onto the... |
Forum: Python Sep 26th, 2009 |
| Replies: 7 Views: 343 It's the only way I could access the strptime function.
The first datetime refers to the datetime package, the second refers to the datetime class.
In my import I could have used something like:... |
Forum: Python Sep 25th, 2009 |
| Replies: 4 Views: 415 There's a python library called 'Freeze' which can be used to create linux executables from python scripts. I don't think it's particularly well known, but I think it's been around longer than... |
Forum: Python Sep 25th, 2009 |
| Replies: 4 Views: 269 hmm, why thank you very much...:)
Is the problem solved?? ;) |
Forum: Python Sep 25th, 2009 |
| Replies: 7 Views: 343 Firstly 'input' is a reserved word in python, it's used to get input from the user, (rather like raw_input!). So that's why this line of code fails to do anything:
input = raw_input("Type Date... |
Forum: Python Sep 25th, 2009 |
| Replies: 11 Views: 360 Hmm, your after fixing your originally posted code (which you've already done)...
When running the code I got an index out of bounds error..
So I've made a minor alteration..Not sure if you've... |
Forum: Python Sep 25th, 2009 |
| Replies: 4 Views: 257 OK, I started working on this when I saw your original post. But since I started, you made your second post. So I've modified it a little to give the line numbers; but I've not got it to output the... |
Forum: Python Sep 25th, 2009 |
| Replies: 1 Views: 155 OK, well there are a few problems with your error checking/input validation. Also your loops are a bit wierd, the program continues after it guesses correctly. And the number guessing algorithm looks... |
Forum: Python Sep 25th, 2009 |
| Replies: 4 Views: 269 OK, here's a very simple class and some code to test it, based on what you posted previously!
# here's a simple class
class MyClass:
# class constructor/initialisation
# if no string is... |
Forum: Python Sep 24th, 2009 |
| Replies: 3 Views: 424 Here's something I just knocked up in a few minutes....This isn't exactly what you're doing, but it should give you a few ideas to use in your game.
My variant uses one tower. The player starts... |
Forum: Python Sep 21st, 2009 |
| Replies: 9 Views: 402 I can't see a problem with the code you've posted!
However if you were using this before:
if x==1 or 2:
Then as gerard has said, the if statement would always evaluate to True...
for... |
Forum: Python Sep 21st, 2009 |
| Replies: 4 Views: 680 This block of code looks like it's presenting the problem:
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
elderly.moveup()
... |
Forum: Python Sep 17th, 2009 |
| Replies: 5 Views: 280 Looking at your original post again, if it's just a case of removing the stuff after the decimal point and then adding your commas in the appropriate place, i'd probably do the following:
If... |
Forum: Python Sep 17th, 2009 |
| Replies: 5 Views: 280 If all you want to do is remove the floating point digits you could do this:
floatValue=3.141
integerValue = int(floatValue)
print "The integer equivalent of", floatValue, "is", integerValue
... |
Forum: Python Sep 9th, 2009 |
| Replies: 4 Views: 277 Ooops! Thinking about it I'm not sure if you can specify command line arguments with py2exe generated exe's...So option 2 is probably out of the question anyway...But option 1 still stands and is... |
Forum: Python Sep 9th, 2009 |
| Replies: 4 Views: 277 I'm not sure exactly what kind of tweaks you're thinking your users might be likely to make to your script, but if your users aren't likely to be needing to make any structural/logical changes to the... |
Forum: Python Aug 8th, 2009 |
| Replies: 8 Views: 357 What have you got so far? |
Forum: Python Aug 7th, 2009 |
| Replies: 4 Views: 319 Alternatively, if the musicback1 script is complete and working, what you could do (especially if musicback1 is used elsewhere in your app) is define another function which calls musicback1 and then... |
Forum: Python Aug 6th, 2009 |
| Replies: 5 Views: 326 OK,
After this line:
label = Tkinter.Label(pg4_group.interior(), image=photo)
try adding the following:
label.photo = photo
This will create an instance of your image in the label,... |
Forum: Python Aug 3rd, 2009 |
| Replies: 4 Views: 232 Hmm, yes that would probably be a more sensible idea!
Jas |
Forum: Python Aug 3rd, 2009 |
| Replies: 4 Views: 232 ignore that last post...all that does is return a numerical value...Not quite what you were after!
J |
Forum: Python Aug 3rd, 2009 |
| Replies: 4 Views: 232 I haven't tried it, but just off the top of my head, would it be worth using a variable to catch whatever value is returned by the system.os call where you're executing mxmlc and then print that... |
Forum: Python Jul 17th, 2009 |
| Replies: 5 Views: 339 Well at first glance the code looks OK....
To confirm it, I just tried your code and it works for me on Windows and Ubuntu (both have Python 2.6 and wxPython 2.8 installed)
I can see the menu,... |
Forum: Python Jul 16th, 2009 |
| Replies: 5 Views: 291 No, I'm afraid not. The selectable text in the usage statistics is a part of the .swf itself.
In other words, when the myspace media player .swf was published from flash, the dynamic text fields in... |
Forum: Python Jul 14th, 2009 |
| Replies: 5 Views: 291 The short answer is there is no way around it.
The flashvars that get passed into the myspace media player .swf are merely the parameters the player needs to be able to rettrieve the artists... |
Forum: Python Jul 8th, 2009 |
| Replies: 5 Views: 372 Do you need to convert the returned value to hex perhaps??
i.e.
byte = hex( abc.B_ABC_Function02(hex(p2), hex(p3)) )
The above code should set the value of byte to be a hexadecimal... |
Forum: Python Jun 24th, 2009 |
| Replies: 5 Views: 630 Sorry to continue a thread that's been marked solved, but I thought I'd better note that the solution I posted would only match a single block of numbers.
If we changed the value of myStr to... |
Forum: Python Jun 24th, 2009 |
| Replies: 5 Views: 630 Shadwickmans solution using filter is a very good one!
Another way is to use regular expressions...
Without further ado, here's a simple example using regular expressions:
#example using... |
Forum: Python Jun 23rd, 2009 |
| Replies: 5 Views: 369 If you're using the windows version of Python3.0 and for some reason you haven't got the shortcuts to idle (i.e. the installer failed to create them, you accidentally deleted them or you used a... |
Forum: Python Jun 19th, 2009 |
| Replies: 3 Views: 268 I've just noticed a few more errors in my post, but I've exceeded the 30 min edit window....Doh! edits are in bold:
Sorry about the DoModal's in my previous post please ignore them...I meant... |
Forum: Python Jun 19th, 2009 |
| Replies: 3 Views: 268 From what I can see it looks like it's because you are calling newName.ShowModal() twice in your code.
In the first call to DoModal in your if statement, a dialog is created and if the user presses... |
Forum: Python Jun 10th, 2009 |
| Replies: 7 Views: 912 Welcome to .dll hell....One of the few things that Microsoft really did create entirely themselves, heh heh! And yes it does suck! ;)
Not everybody who uses your app would have to install the MSVC... |
Forum: Python Jun 10th, 2009 |
| Replies: 1 Views: 323 From what I can see, the who_knows() fuunction takes two lists as parameters.
It then iterates through list a and calls is_mem() passing list b and the current item
is_mem iterates through the... |
Forum: Python Jun 9th, 2009 |
| Replies: 3 Views: 988 There are a few Python libraries out there which can do this. I think the most popular is py2exe. Google it, you'll find it!
If you're a windows user, there are py2exe installers available for... |
Forum: Python Jun 9th, 2009 |
| Replies: 7 Views: 912 This is purely down to .dll's. Namely the msvcrXX runtimes (msvcr70.dll, msvcr90.dll etc)
If the target machine does not have Python installed, then it needs to have the correct version of the... |