python

Minimize to gnome panel

I have an application written in python, I would like it to be able to "minimize" to the gnome panel, much like how gnome's rhytmbox minimizes to the panel. Is it easily possible to do this? I've run the examples from here but failed to get any of them working and those don't seem to be exactly what I'm looking for. Any good places to ...

Generator in if-statement in python

Or How to if-statement in a modified list. I've been reading StackOverflow for a while (thanks to everyone). I love it. I also seen that you can post a question and answer it yourself. Sorry if I duplicate, but I didn't found this particular answer on StackOverflow. How do you verify if a element is in a list but modify it in the sa...

python or database?

i am reading a csv file into a list of a list in python. it is around 100mb right now. in a couple of years that file will go to 2-5gigs. i am doing lots of log calculations on the data. the 100mb file is taking the script around 1 minute to do. after the script does a lot of fiddling with the data, it creates URL's that point to google ...

In class definition inherited from dict why is there a difference in defining attributes?

In a class inherited from dict, why don't the two ways of defining an attribute produce the same result? Why do I see attr1 but not attr2? class my_dict(dict): def __init__(self): dict.__init__(self) self['attr1'] = 'seen' setattr(self, 'attr2', 'unseen') In [1]: x = my_dict() In [2]: x Out[2]: {'attr1': 'seen'...

Print to the same line and not a new line in python

Basically I want to do the opposite of what this guy did... hehe. http://stackoverflow.com/questions/529395/python-script-print-new-line-each-time-to-shell-rather-than-update-existing-line I have a program that is telling me how far along it is. for i in some_list: #do a bunch of stuff. print i/len(some_list)*100," percent com...

wxPython: How to make a TextCtrl fill a Panel

How do I set the size of a multi-line TextCtrl to always fill its parent panel? ...

networking program crashes

hey guys, i got this code from http://www.evolt.org/node/60276 and modified it to listen for a single "1" coming from the other side but whenever i run this program it stops and python IDLE goes to non-responding on "data1,addr = UDPSock.recvfrom(1024)" def get1(): # Server program, receives 1 if ball found # ff1 is file w/ received da...

How do I use Mox to mock a module function and allow it to be called in almost any way.

I have a function A that call another function B several times. I want to mock B in such a way that any number of calls that have the correct number of arguments, regardless of value, will return a fixed vale and be treated as correct. If or how many times the the function is called is not a part of the spec. ...

Python: filter dict to contain only certain keys?

I've got a dict that has a whole bunch of entries. I'm only interested in a select few of them. Is there an easy way to prune all the other ones out? ...

What's better, ConfigObj or ConfigParser?

Which is better for creating a settings file for Python programs, the built-in module (ConfigParser), or the independent project (ConfigObj)? ...

Porting Quartz 2d python demo to pure Core Graphics C

Hi folks, let me first off noting that I have absolutely no idea what I'm doing with objective-c and mac development (though I'm fine with c). I made a wonderfully simple graphics utility on leopard with the Quartz-2d binding for python: http://developer.apple.com/graphicsimaging/pythonandquartz.html that basically inputs a text file ...

What is a good django library for logging in users with Twitter, Facebook or an OpenID provider?

I want to create an application that allows a user to register and login to a django application with an external provider. In addition, I then want the user to be able to associate additional accounts with that initial account. Finally, I would like the user to be able to login to the application with one of the other associated account...

Python vs C#/.NET -- what are the key differences to consider for using one to develop a large web application?

My organization currently delivers a web application primarily based on a SQL Server 2005/2008 back end, a framework of Java models/controllers, and ColdFusion-based views. We have decided to transition to a newer framework and after internal explorations and mini projects have narrowed the choice down to between Python and C#/.NET. Le...

I can retrieve values from datastore

Hi, I want to retrieve some values I put in the data store with a model class name "Ani" and I have tried using the script below to do that but I am having problem with. Can someone please, help me with it import random import getpass import sys # Add the Python SDK to the package path. # Adjust these paths accordingly. sys.path.append...

How can I assign names to some numbers to feed them into a random number generator as variables

Hi, I need some assistance here. import urllib2 pen = urllib2.Request("http://silasanio.appspot.com/mean_stdev") response = urllib2.urlopen(pen) f = response.read() print f -0.0011935729005 0.0313498454115 ............... .............. the numbers above were returned together with some other texts. My problem is I want those number...

How can I make a macro recorder/player with pyHook in Python?

I want to make a little script that, when pressed some specific key, for example F2, the macro starts to record the mouse actions, only the location of the click, and then play it when pressed another specific key... Could someone give me a little example of what I have to do? ...

Algorithm to find which number in a list sum up to a certain number.

I have a list of numbers. I also have a certain sum. The sum is made from a few numbers from my list (I may/may not know how many numbers it's made from). Is there a fast algorithm to get a list of possible numbers? Written in Python would be great, but pseudo-code's good too. (I can't yet read anything other than Python :P ) Example l...

Simple protocols (like twisted.pb) vs messaging (AMQP/JMS) vs web services (REST/SOAP)

Hi, I'm currently using twisted's perspective broker on python and I have considered in the past switching to something like RabbitMQ but I'm not sure it could just replace pb - I feel like I might be comparing apples to oranges here. I've been reading a lot about REST lately and the inevitable debate with SOAP, which led me to read abou...

gsm modem in python

Hi dears. I want make relation with gsm modem. my first goal and main one is sending and receiving sms. then I want go front.for example for mms sending and ... I want to do it on a linux server. please introduce me a suitable modula with it's tutorial or documentation. thanks if guide me. ...

Python: "global name 'time' is not defined"

I'm writing a silly program in python for a friend that prints "We are the knights who say 'Ni'!". then sleeps for 3 seconds, and then prints "Ni!" twenty times at random intervals using the random module's uniform() method. Here's my code: from time import sleep import random def knights_of_ni(): generator = random.Random() pr...