In the following code, there is not just one circle on the screen at any given point in time.
I want to fix this to make it so that it looks like there is only one circle, instead of leaving a smudge trail where ever the mouse cursor has been.
import pygame,sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode(...
I am trying to make a flex application where it gets data from a telnet connection and I am running into a weird problem.
To give a brief introduction, i want to read data from a process that exposes it through a socket. So if in the shell i type telnet localhost 8651i receive the xml and then the connection is closed (I get the followi...
I've noticed differing implementations of the modulus operator in Python and Java.
For example, in Python:
>>> print -300 % 800
>>> 500
Whereas in Java:
System.out.println(-300 % 800);
-300
This caught me off guard, since I thought something as basic as modulus was universally interpreted the same way. I'm a fan of Python's interp...
Before the question, the background:
I am putting the finishing touches on an API I have written for a Django app utilizing django-piston. The API is able to search by request or IP address which are Request or IPAddress instances respectively. Each request can have 1 or more IPAddress associated with it.
So, for example I have an API...
Here's a plot I made using matplotlib. It uses the bar and scatter methods from pylab.
I have 3 issues:
How to make the error bars fatter? No API in bar for this that I can see.
How to specify the axes properly?
How to stop the x-axis labels from showing?
The first is most important, as I have no idea. I guess one more thing would b...
I'm getting a non-descriptive (or at least I don't know how to interpret in this context) error message when sub-lassing from a Django-Treebeard node and am not sure how to debug. I'm using the installation instructions at: http://code.tabo.pe/django-treebeard/src/tip/tbexample/ (see at end of posting).
I create a subclass of MP_Node a...
I am using BeautifulSoup to parse XML:
xml = """<person>
<first_name>Matt</first_name>
</person>"""
soup = BeautifulStoneSoup(xml)
first_name = soup.find('first_name').string
last_name = soup.find('last_name').string
But I have a problem when there is no last_name, because it chokes. Sometimes the feed has it, and sometimes it doesn...
How do I write the setup.cfg file for distutils such that setup.py bdist_rpm generates a PGP-signed RPM? I'd like to be able to offer signed packages without needing to add a second build system on top of distutils.
...
import socket
from time import strftime
time = strftime("%H:%M:%S")
irc = 'irc.tormented-box.net'
port = 6667
channel = '#test'
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.connect((irc, port))
print sck.recv(4096)
sck.send('NICK supaBOT\r\n')
sck.send('USER supaBOT supaBOT supaBOT :supaBOT Script\r\n')
sck.send('JOIN ' ...
I am using Graphviz in Python via pydot. The diagram I am making has many clusters of directed graphs. pydot is putting them next to each other horizontally resulting in an image that is very wide. How can I tell it to output images of a maximum width so that I can scroll vertically instead?
...
I would like to write a Django template tag to which I can pass a variable.
I would like the template tag to behave differently depending on what type of model field the variable was derived from (CharField, BooleanField, IntegerField, etc.) as well as other information used in the field's definition (max_length, etc.)
I can pass the v...
I'm writing some documentation with Sphinx and I'd like to print out a certain block of text only for HTML documentation, not for LaTeX documentation. Something tells me I should be able to do this with sphinx.ext.ifconfig but I can't figure out how. Does anyone know how to do this?
...
Hello everyone.
I'm having a problem getting CGI to work for Python.
I've added
Options ExecCGI
AddHandler cgi-script cgi py pl
inside /etc/apache2/sites-available/default within
and now Perl works, but Python gives out a 500 Internal Server Error..
EDIT:
This if the current 'default' file
<VirtualHost *:80>
ServerAdmin web...
I would like to use gstreamer to save an arbitrary clip from one audio file to a new file. For example, a segment from 1 minute to 2 minutes in the original. How do I do it?
...
I have an application running on AppEngine that uses about 50 CPU hours a day. Most of it is spent waiting for the datastore.
I am contemplating moving it off of AppEngine to something like Rackspace Cloud Servers because I think that my application can be more efficient if I can offload some of the work to the database (plus I can add...
I have a class:
class A(object):
def __init__(self,a,b,c,d,e,f,g,...........,x,y,z)
#do some init stuff
And I have a subclass which needs one extra arg (the last W)
class B(A):
def __init__(self.a,b,c,d,e,f,g,...........,x,y,z,W)
A.__init__(self,a,b,c,d,e,f,g,...........,x,y,z)
self.__W=W
It seems du...
Dear all,
I am trying to play some audio files with the CLI example on this site:
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html
I am on windows and it is giving error while reading the file. I specified
the following path:
$ python cliplayer.py C:\\voice.mp3
0:00:00....
I have a huge file (over 16,000 lines) that I want to save in the datastore for parsing later. Each line contains info on an entity.
How do I read line by line from the stored Blob?
I can't seem to find a good tutorial or documentation on a Blob anywhere. GAE only shows how to deal with images, but I want to read from the stored te...
...for current user? for all users?
I'm working an a small program which needs to create links in the start menu. Currently I'm hardcoding like below, but it only works in english locales, for example it should be "Startmenü" in german. What are cleaner, more portable approaches?
OUR_STARTMENU = os.environ['ALLUSERSPROFILE'] + '\Start...
I would like to have the user input a date, something like:
date = input('Date (m/dd/yyyy): ')
and then make sure that the input is a valid date. I don't really care that much about the date format.
Thanks for any input.
...