I want my widget to look exactly like it does now, except to be smaller. It includes buttons, labels, text, images, etc. Is there any way to just say "scale this to be half the size", and have GTK do all the image processing, widget resizing, etc., necessary? If not, what's the easiest way to accomplish this?
...
In GTK, how can I scale an image? Right now I load images with PIL and scale them beforehand, but is there a way to do it with GTK?
...
Is there an easy way to change the font size of text elements in GTK? Right now the best I can do is do set_markup on a label, with something silly like:
lbl.set_markup("<span font_desc='Tahoma 5.4'>%s</span>" % text)
This 1) requires me to set the font , 2) seems like a lot of overhead (having to parse the markup), and 3) would make ...
Hi all,
Basically, I have a python program which listens for DeviceAdded DBus events (e.g. when someone plugs in a USB drive), and when an event occurs, I want to create a thread which collects metadata on that newly connected device. However, I want to do this asynchronously - that is, allow one thread to keep collecting metadata on th...
As you may be able to tell from my questions, I'm new to both python and django. I would like to allow dynamic filter specifications of query sets from my templates using **kwargs. I'm thinking like a select box of a bunch of kwargs. For example:
<select id="filter">
<option value="physician__isnull=True">Unassigned patients</opti...
So, I've been noodling about with Django's generic views, specifically the object_list view. I have this in my urls.py:
from django.conf.urls.defaults import *
from django.views.generic import list_detail
from diplomacy.engine.models import Game
game_info = {
"queryset": Game.objects.filter(state__in=('A', 'P')),
"template_obj...
Possible Duplicates:
Best online resource to learn Python?
Python Forums
I am a python beginner. Can you give me some suggests ?
...
I recently wrote a short algorithm to calculate happy numbers in python. The program allows you to pick an upper bound and it will determine all the happy numbers below it. For a speed comparison I decided to make the most direct translation of the algorithm I knew of from python to c++.
Surprisingly, the c++ version runs significantly...
Hi, is it possible to have mechanize follow an anchor link that is of type javascript?
I am trying to login into a website in python using mechanize and beautifulsoup.
this is the anchor link
<a id="StaticModuleID15_ctl00_SkinLogin1_Login1_Login1_LoginButton" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&...
A little background: I'm in the process of learning Python through O'Reilly's, "Learning Python" book, I've had some experience in Java.
Anyway, upon reading Chapter 5 (I'm still in the middle of it, actually) I have come across a question with the way Python treats results of Mixed Numeric expressions. In the book, they use an example...
hello,
I would like to POST multipart/form-data encoded data.
I have found an external module that does it: http://atlee.ca/software/poster/index.html
however I would rather avoid this dependency. Is there a way to do this using the standard libraries?
thanks
...
Lets say Python is installed in the location "C:\TOOLS\COMMON\python\python252" .
I want to print this location in the output of my program. Please let me know which is the function for doing this.
Thank you very much.
...
I want to grab the docstring in my commandline application, but every time I call the builtin help() function, Python goes into interactive mode.
How do I get the docstring of an object and not have Python grab focus?
...
I need some help to print out the line with the longest length, the line with the highest sum of ASCII values, or the line with the greatest number of words from a text file. This is my first time programming and I'm really struggling with python and don't know how to calculate want is required for my lab this week. I 've try to work it ...
I'm working on a web project in Django, and I'm using the python unittest framework. For every app I have some fixtures. This means, that every app has some identical tables in fixtures. I would like to share fixtures between apps and testcases, because otherwise if I change a model, I will have to change all json fixtures where this con...
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\ctypes\__init__.py", line 17, in <module>
from struct import ca...
Most concise way to check whether a list is empty or [None]?
I understand that I can test:
if MyList:
pass
and:
if not MyList:
pass
but what if the list has an item (or multiple items), but those item/s are None:
MyList = [None, None, None]
if ???:
pass
...
We are working with a code repository which is deployed both to windows and linux, sometimes on different directories.
How should one of the modules inside the project refer to one of the non-python resources in the project (CSV file, etc.)?
If we do something like
thefile=open('test.csv')
or
thefile=open('../somedirectory/test.csv')...
I'm a complete Python noob. How can I remove two characters from the beginning of each line in a file? I was trying something like this:
#!/Python26/
import re
f = open('M:/file.txt')
lines=f.readlines()
i=0;
for line in lines:
line = line.strip()
#do something here
...
Is there a way to automatically resize a figure to properly fit contained plots in a matplotlib/pylab image?
I'm creating heatmap (sub)plots that differ in aspect ratio according to the data used.
I realise I could calculate the aspect ratio and manually set it, but surely there's an easier way?
...