Unicode fonts in PyGame
How can I display Chinese characters in PyGame? Also, what's a good free/libre font to use for this purpose? Thanks ...
How can I display Chinese characters in PyGame? Also, what's a good free/libre font to use for this purpose? Thanks ...
I am trying to pull at list of resource/database names and IDs from a listing of resources that my school library has subscriptions to. There are pages listing the different resources, and I can use urllib2 to get the pages, but when I pass the page to BeautifulSoup, it truncates its tree just before the end of the entry for the first r...
I have installed Python 3k(C:\Python30) and Visual Studio Professional Edition 2008. I'm studying this. Here is a problem: C:\hello>dir Volume in drive C has no label. Volume Serial Number is 309E-14FB Directory of C:\hello 03/21/2009 01:15 AM <DIR> . 03/21/2009 01:15 AM <DIR> .. 03/21/2009 01:14 AM ...
What I want to do is build some mini cms which hold pages with a uri. The last route in my urls.py points to a function in my views.py, which checks in the datastore if there's a page available with the same uri of the current request, and if so show the page. I have a model: class Page(db.Model): title = db.StringProperty(require...
I need to change the display text of a MenuItem. Is there any way of doing this without removing the MenuItem and then adding another one with a different text? ...
How do I get the encoding that is used for the string returned by GetUserName from the win32 API? I'm using pywin32 and it returns an 8-bit string. On my German XP, this string is obviously encoded using Latin-1, but this might not be the case for other Windows installations. I could use GetUserNameW, but I would have to wrap that mysel...
I have a pretty simple question. I want to make some date-based generic views on a Django site, but I also want to paginate them. According to the documentation the object_list view has page and paginate_by arguments, but the archive_month view does not. What's the "right" way to do it? ...
I am trying to create a class that doesn't re-create an object with the same input parameters. When I try to instantiate a class with the same parameters that were used to create an already-existing object, I just want my new class to return a pointer to the already-created (expensively-created) object. This is what I have tried so far...
I've written some python code to download an image using urllib.urlopen().read() and then upload it to an FTP site using ftplib.FTP().storbinary() but I'm having a problem. Sometimes the image file is only partially uploaded, so I get images with the bottom 20% or so cut off. I've checked the locally downloaded version and I have...
Problems to get permissions of each file in every folder to find files which have 777 permissions, and then print the filenames with their paths to a list We can get permissions for files in one folder by ls -ls I do not know how you can get permissions of each file in every folder effectively. How can you find files which have ...
I'm building a Python application that needs to communicate with an OAuth service provider. The SP requires me to specify a callback URL. Specifying localhost obviously won't work. I'm unable to set up a public facing server. Any ideas besides paying for server/hosting? Is this even possible? ...
I am using this file storage engine to store files to Amazon S3 when they are uploaded: http://code.welldev.org/django-storages/wiki/Home It takes quite a long time to upload because the file must first be uploaded from client to web server, and then web server to Amazon S3 before a response is returned to the client. I would like to ...
If I have run a long line in IPython, and try and recall it (using the up-arrow) or backspace beyond the start of the current line, it displays incorrectly (all smushed into one line) For example, in the following session I wrote a long line [1], entered a somewhat-blank line [2], then up-arrowed twice to get the print statement on line...
What's the best (or if that's too subjective, let's say "good", "well supported", "up-to-date", "you like it") python library, for generating RSS ? (Circa 2009) Update : Thanks everyone. Didn't see this was duplicate (http://stackoverflow.com/questions/57117/recommended-python-rssatom-feed-generator). Sorry. ...
I'm building an app in python, and I need to get the URL of all links in one webpage. I already have a function that uses urllib to download the html file from the web, and transform it to a list of strings with readlines(). Currently I have this code that uses regex (I'm not very good at it) to search for links in every line: for line...
I have the following code: proxy_index = self.log_list.filter_proxy_model.createIndex(index, COL_REV) model_index = self.log_list.filter_proxy_model.mapToSource(proxy_index) revno = self.log_list.model.data(model_index,QtCore.Qt.DisplayRole) self.setEditText(revno.toString()) The code crashed on the second line. There is no exception ...
Hi I'm using PIL im = Image.open(teh_file) if im: colors = im.resize( (1,1), Image.ANTIALIAS).getpixel((0,0)) # simple way to get average color red = colors[0] # and so on, some operations on color data The problem is, on a few (very few, particulary don't know why those exactly, simple jpegs) I get 'unsubscri...
I'm working on a Django site that has multiple sections and subsections. I'd like to have several depths of template inheritance: a base template for the whole site, one base template for each section that inherits from the root base template, and so on. Here's a simplified version of my desired directory structure: base.html section1/ ...
I'm writing an application in Python (2.6) that requires me to use a dictionary as a data store. I am curious as to whether or not it is more memory efficient to have one large dictionary, or to break that down into many (much) smaller dictionaries, then have an "index" dictionary that contains a reference to all the smaller dictionarie...
Let's say that I've got my code base to as high a degree of unit test coverage as makes sense. (Beyond a certain point, increasing coverage doesn't have a good ROI.) Next I want to test performance. To benchmark code to make sure that new commits aren't slowing things down needlessly. I was very intrigued by Safari's zero tolerance poli...