I need to convert series of images drawn as white on black background letters to images where white and black are inverted (as negative). How can I achieve this using PIL?
You can add a property to a class using a getter and a setter (in a simplistic case):
class<X>("X")
.add_property("foo", &X::get_foo, &X::set_foo);
But how to add a property to a module itself (not a class)?
There is
scope().attr("globalAttr") = ??? something ???
and
def("globalAttr", ??? something ???);
I can add global…
I'm working on a game project.
I've created an object, Star(Object).
I want to assign the name of the variables, dynamically, from a text file.
If I have a text file with:
Sol
Centauri
Vega
I want the program to create the Star(Object) with variable names from the text file. I want the process automated, because I'm looking to create hundreds of…
Hi,
I have not a lot of knowledge of python and network programming. Currently I am trying to implement a simple application which can receive a text message sent by the user, fetch some information from the google search api, and return the results via text message to the user. This application will continue to listening to the users messages and…
Hello,
I'm planing to learn python this weekend. I have some programing skills and should not be difficult if I take the good path.
I'm a sysadmin and I've been looking at python scripts since long ago, but now I would like to make python my scripting language, so I'll do the effort and next monday I will start using it.
Any advice on how to…
My program uses sqlite3 plus python. It works fine with python 2.6.2
I moved it another machine and installed 2.6.4 and running the program gave me this error
File "", line 1, in
File "/opt/python-2.6.4/lib/python2.6/sqlite3/init.py", line 24, in
from dbapi2 import *
File…
I'd like to be able to do:
>>> class a(str):
... pass
...
>>> b = a()
>>> b.__class__ = str
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __class__ assignment: only for heap types
pdb and winpdb both seem to be missing this essential (to me) feature. I saw something suggesting WingIDE has it but I'd prefer a solution that is free, and if I do have to pay, I'd prefer to pay for something that is better than Wing.
I'm having trouble understanding the result of the following statements:
>>> from array import array
>>> array('L',[0xff,0xff,0xff,0xff])
array('L', [255L, 255L, 255L, 255L])
>>> from array import array
>>> array('L','\xff\xff\xff\xff')
Traceback (most…
I want to write a Python web application that queries RDF triples using Prolog. I found pyswip for interfacing Python with SWI-Prolog, and I am currently looking into SWI-Prolog's RDF capabilities. I am wondering if anyone has tried this before--and if anyone has: what did your setup look…
Following this recommendation, I have written a native C extension library to optimise part of a Python module via ctypes. I chose ctypes over writing a CPython-native library because it was quicker and easier (just a few functions with all tight loops inside).
I've now hit a snag. If I…
I am trying to use some AOP in my Python programming, but I do not have any experience of the various libs that exists. So my question is :
What AOP support exists for Python, and what are the advantages of the differents libraries between them ?
Edit : I've found some, but I don't…
When is Python 3.1 meant to become mainstream Python version? How many years are to pass before Python 3.1 support and adoption grows any close to of today Python 2.6?
I am making a project where I need several modules which are imported into one main module to make a pizza ordering service. Upon finishing this (to a working standard) I decided to re-code it so that the whole order is completed with one tkinter window, now instead of using input(),…
I want to run a csh file from a python scrip,
example,
#!/usr/bin/python
import os
os.system("source path/to/file.csh")
and I want this file to run in the same shell as I am running the python script, because the file.csh script is settings some environment variables that I…
I'm trying to install the module mySQLdb on a windows vista 64 (amd) machine.
I've installed python on a different folder other than suggested by Python installer.
When I try to install the .exe mySQLdb installer, it can't find python 2.5 and it halts the installation.
Is there…
Hi .. somewhat of a noob here to web programming. Just getting my feet wet in python. I wanted to implement web hooks in python. Both at server end and client end. Is there any particular library for implementing web hooks? Or does django or twisted python handle this?
Please see the following code:
def good():
foo[0] = 9 # why this foo isn't local variable who hides the global one
def bad():
foo = [9, 2, 3] # foo is local, who hides the global one
for func in [good, bad]:
foo = [1,2,3]
print('Before "{}":…
I'm having trouble understanding the result of the following statements:
>>> from array import array
>>> array('L',[0xff,0xff,0xff,0xff])
array('L', [255L, 255L, 255L, 255L])
>>> from array import array
>>>…
how to call a server side python script from javascript. if test.py is the python script file in server, and if the parameter to be passed to python is another url , then how this can be executed from javascript, how the return string from…
How can I replace a string with another string, within a given text file. Do I just loop through readline() and run the replacement while saving out to a new file? Or is there a better way?
I'm thinking that I could read the whole thing…
With jquery it's very easy to insert some element inside another element using the selector technology, I am wondering if there is any pythonlibrary that can do things similar with jquery, the reason is I want server side python program…
I am a web developer and usually use php/JS/mysql.
I have heard lot about python.
I have no idea where is python used and why it is used.
Just like
php/asp/cold fusion/.net/
are used to build websites
C, C++ , Java
are used to…