In every game I make with pygame it won't register any more then 2 simultaneous key presses. (e.g. if I'm holding up and left to move it won't let me press space to fire.) Is this software? Hardware? Is there anything I can do about it?
EDIT: I use a Digital Media Keyboard 3000 on one computer and it does pretty good. According to K...
How can I retrieve names of all builtins for my current python distribution during runtime?
...
>> url = 'https://test.authorize.net/gateway/transact.dll'
>> data = {'x_login': 'abc123', 'x_type': 'AUTH_CAPTURE', 'x_card_num': '4444333322221103', 'x_amount': '50.75', 'x_tran_key
': 'abc123', 'x_version': '3.1', 'x_delim_char': '|', 'x_exp_date': '022012', 'x_delim_data': 'TRUE'}
>>
>> urllib2.urlopen(url, data)
Traceback (most rec...
Using SimpleParse on Windows and following the examples at http://simpleparse.sourceforge.net/scanning_with_simpleparse.html, the following error happens:
ValueError: Unable to complete parsing of the EBNF
SimpleParse has not problem doing the same on Ubuntu Linux.
...
Hello anyone,
I have django-registration installed. I just updated my Python installation from 2.5 to 2.7.
Everything works okay but when I try to run my Django app, I get the error below.
C:\django\pley>python manage.py runserver
Validating models...
Unhandled exception in thread started by <function inner_run at 0x02FA6830>
Tracebac...
How can I get access to the implicit property names of a db.Model in Google App Engine? In particular, assume I have the following:
class Foo(db.Model):
specific = db.IntegerProperty()
class Bar(db.Model):
foo = db.ReferenceProperty(Foo, collection_name = "bars")
if I attempt to get the property names on Foo, like so:
my_foo = ...
I modified the source code from Fred Lundh's Python Standard Library.
The original source uses popen2 to communicate to subprocess, but I changed it to use subprocess.Popen() as follows.
import subprocess
import string
class Chess:
"Interface class for chesstool-compatible programs"
def __init__(self, engine = "/opt/local/bin...
Say I have a class Box with two attributes, self.contents and self.number. I have instances of box in a list called Boxes. Is there anyway to access/modify a specific instance by its attribute rather than iterating through Boxes? For example, if I want a box with box.number = 40 (and the list is not sorted) what would be the best way to ...
Is it possible to create a ui using traits from python to make an interface for a cellular automata simulation?
...
In my code I've connected to the WebView's load-finished event. The particular callback function takes a webview object and frame object as arguments. Then I tried executing get_dom_document() on the frame & the webview objects respectively. It seems this method doesn't exist for those objects...
PS: i started with the tips i got here h...
In Panda3D, I have the following code
self.manager = FilterManager(base.win, base.cam)
self.sceneTex = Texture("scene")
self.depthTex = Texture("depth")
self.quad = self.manager.renderSceneInto(colortex=self.sceneTex, depthtex = self.depthTex)
...
When I run the above and enable view buffers (show-buffers #t), the "sceneTex" te...
what's the quickest way to take a list of files and a name of an output file and merge them into a single file while removing duplicate lines?
something like
cat file1 file2 file3 | sort -u > out.file
in python.
prefer not to use system calls.
AND:
what's the quickest way to split a list in python into X chunks (list of lists) as eq...
I want to write a simple python web application to provide a gui to a command line program (think of hg serve, for example). It would run locally only. I don't want it to have any external dependencies for an easier deployment, so python web programming in general wouldn't apply here
How can it be done with a minimal hassle? Any pointe...
Hi.
I have a list of actions on a menu in PyQt, one for each different feed I want to display. So I have a Y that sets the active feed to Y, Z sets it to Z, etc. (For a webcomic reading program).
I have each on the menu, and felt that an automated approach might be better; rather than typing out each time. Something like a function tha...
Hi there,
I need to search a pretty large text file for a particular string. Whats the best way to go about doing that?
Thanks
Edit: Should have given more detail, my bad. Its a build log with about 5000 lines of text. Using regex shouldn't cause any problems should it? I'll go ahead and read blocks of lines, and use the simple find. ...
Here is a snippet of how my models are setup:
class Profile(models.Model):
name = models.CharField(max_length=32)
accout = models.ManyToManyField(
'project.Account',
through='project.ProfileAccount'
)
def __unicode__(self)
return self.name
class Accounts(models.Model):
name = models.Ch...
Hello,
I'm using this to convert date time strings to a unix timestamp:
str(int(time.mktime(time.strptime(date,"%d %b %Y %H:%M:%S %Z"))))
However often the date structure isn't the same so I keep getting the following error message:
time data did not match format: data=Tue, 26 May 2009 19:58:20 -0500 fmt=%d %b %Y %H:%M:%S %Z
...
I'm a bit rusty in Python and am just looking for help implementing an example function to count words (this is just a sample target for a scons script that doesn't do anything "real"):
def countWords(target, source, env):
if (len(target) == 1 and len(source) == 1):
fin = open(str(source[0]), 'r')
# do something with "f.read()...
Is there any reason to use one over the other?
Do they have the same performance?
...
I made a .pyw python script that I want to have running in the background of my computer.
Right now I have it set to launch by putting it in the Startup folder of my Windows 7 computer, which should trigger it to launch whenever it starts up.
The problem is that the script seems to stop running at some point for some reason. I think it...