Is there a way to get the width, in pixels, that a gtk.TreeViewColumn would want to be if the sizing mode was set as gtk.TREE_VIEW_COLUMN_AUTOSIZE, even if it's currently gtk.TREE_VIEW_COLUMN_FIXED?
...
I am trying to implement a python script which writes and reads to a database to track changes within a 3d game (Minecraft) These changes are done by various clients and can be represented by player name, coordinates (x,y,z), and a description. I am storing a high volume of changes and would like to know what would be an easy and prefera...
I have a messageDialog set up so that its default response is gtk.RESPONSE_OK so the okay button is clicked when the user hits enter even if the okay button does not have focus. I would like to also have the space bar trigget the default_response. What is the best way to do this?
This is with python 2.4 in a linux environment. Unfortuna...
How can I convert colors from (N, N, N) format to #AABBCC (and #AAABBBCCC) ?
thanks
...
Let's suppose I have several functions for a RPG I'm working on...
def name_of_function():
action
and wanted to implement axe class (see below) into each function without having to rewrite each class. How would I create the class as a global class. I'm not sure if I'm using the correct terminology or not on that, but please help...
simple Python question:
Example list: A = [1,2,3,4,5]
I need to generate another list B which is a shallow copy of list A such that B is a new list containing the same elements in the same order (so that I can substitute one of B's elements w/o affecting A). How can I do this?
clarification: I want to do something like
def some_fun...
If I have a MultiValueField on one of my search indexes and I want to display each value in the search results, how would I do that? It seems like something is not being formatted appropriately or I am somehow misunderstanding the MultiValueField.
class PageAttachmentIndex(indexes.SearchIndex):
# This should reference search/indexes/pa...
I've seen a bunch of solutions on the site to remove duplicates while preserving the oldest element. I'm interested in the opposite: removing duplicates while preserving the newest element, for example:
list = ['1234','2345','3456','1234']
list.append('1234')
>>> ['1234','2345','3456','1234','1234']
list = unique(list)
>>> ['2345','345...
I'm running a model in Python and I'm trying to speed up the execution time. Through profiling the code I've found that a huge amount of the total processing time is spent in the cell_in_shadow function below. I'm wondering if there is any way to speed it up?
The aim of the function is to provide a boolean response stating whether the s...
I have a dictionary in Python that I would like to serialize in JSON and convert to a proper C string so that it contains a valid JSON string that corresponds to my input dictionary. I'm using the result to autogenerate a line in a C source file. Got it? Here's an example:
>>> import json
>>> mydict = {'a':1, 'b': 'a string with "quotes...
I'm working on a script currently that needs to pull information down from a specific user's wall. The only problem is that it requires authentication, and the script needs to be able to run without any human interference. Unfortunately all I can find thus far tells me that I need to register an application, and then do the whole FB Conn...
Related to: http://stackoverflow.com/questions/2179958/django-pisa-adding-images-to-pdf-output
I've got a site that uses the Google Chart API to display a bunch of reports to the user, and I'm trying to implement a PDF version. I'm using the link_callback parameter in pisa.pisaDocument which works great for local media (css/images), but...
I am using the Python module telnetlib to create a telnet session (with a chess server), and I'm having an issue I really can't wrap my brain around. The following code works perfectly:
>>> f = login("my_server") #code for login(host) below.
>>> f.read_very_eager()
This spits out everything the server usually prints upon login. Howeve...
Hello. I am trying to synchronize flickr with django. I am using django-syncr app. But i stacked in somewhere.
Database syncdb is ok. But how do we sync the images? Where do we write below code.
from syncr.app.flickr import FlickrSyncr
f = FlickrSyncr(API_KEY, API_SECRET)
f.syncRecentPhotos('username', days=7)
f.syncPublicFavorites('...
Is something like this bad with memcache?
1. GET LIST OF KEYS
2. FOR EACH KEY IN LIST OF KEYS
- GET DATA
I'm expecting the list of keys to be around ~1000 long.
If this is bad, I'm wondering if there is a better way to do this? I figured memcache might be fast enough where such an O(n) query might not be so important. I would ne...
I'd like to sum one particular row of a large NumPy array. I know the function array.max() will give the maximum across the whole array, and array.max(1) will give me the maximum across each of the rows as an array. However, I'd like to get the maximum in a certain row (for example, row 7, or row 29). I have a large array, so getting the...
Running python on Snow Leopard, and I can't import the 'time' module. Works in ipython. Don't have any .pythonrc files being loaded. Scripts that 'import time' using the same interpreter run fine. Have no idea how to troubleshoot this. Anyone have an idea?
[wiggles@bananas ~]$ python2.6
Python 2.6.6 (r266:84292, Sep 1 2010, 14:27:13)
...
I have a label sitting on a frame which is updated periodically to show the status of the application. Periodically, the name of the item being processed will not fit into the window, and with the way I currently have the label configured the window expands to accomidate the label.
Ideally, I'd like way to smartly truncate the text o...
I have some things that do not need to be indexed or searched (game configurations) so i wa sthinking of storing json on a blob. is this a good idea at all? or are there alternatives?
...
I mean that the user interface and the server logic are like one thing, and no html/js is used.
There is an excellent C++ web toolkit, which does exactly this:
http://www.webtoolkit.eu/wt
Is there python equivalent/alternative?
Note: pyjamas does not count - it's great, but client side only.
Thanks!
...