I would like to create a StringVar() that looks something like this:
someText = "The Spanish Inquisition" #Here's a normal variable whose value I will change
eventually
TkEquivalent = StringVar() #and here's the StringVar()
TkEquivalent.set(string(someText)) #and here I set it equal to the normal variable. When
someText changes, t...
I'm looking for a nice tutorial or framework for developing Python written web applications.
I've done lots in PHP, but very little in Python or Ruby and figured I'd start with the first one alphabetically.
...
For example, if you have n lists of bools of the same length, then elementwise boolean AND should return another list of that length that has True in those positions where all the input lists have True, and False everywhere else.
It's pretty easy to write, i just would prefer to use a builtin if one exists (for the sake of standardizati...
The Ruby LESS gem looks awesome - and I am working on a Python/Pylons web project where it would be highly useful. CSS is, as someone we're all familiar with recently wrote about, clunky in some important ways. So I'd like to make it easier on myself.
Is there an existing Python module or library that provides parallel functionality?
...
I have a python class, and I need to add an arbitrary number of arbitrarily long lists to it. The names of the lists I need to add are also arbitrary. For example, in PHP, I would do this:
class MyClass {
}
$c = new MyClass();
$n = "hello"
$c.$n = array(1, 2, 3);
How do I do this in Python?
I'm also wondering if this is a reasonabl...
There is a PostgreSQL database on which I only have limited access (e.g, I can't use pg_dump). I am trying to create a local "mirror" by exporting certain tables from the database. I do not have the permissions needed to just dump a table as SQL from within psql. Right now, I just have a Python script that iterates through my table_names...
I am using pygame and livewires (though I don't think that part is relevant here) to create a game. I've got the game working, but I'm trying to make something akin to a title screen before the game starts. However, it doesn't recognize when I try to make a new line appear. Here is what I have:
begin_message=games.Message(value=""" ...
A project that involves image processing, i.e. to calculate the angular shift of the same image when shifted by a medium of certain Refractive Index. We have to build an app that correlates the 2 images (phase/2D correlation?) and then plot using Chaco and Mayavi (2 libraries in Python).
Is there any other existing template software (FOS...
Could you clarify some ideas behind Python classes and class instances?
Consider this:
class A():
name = 'A'
a = A()
a.name = 'B' # point 1 (instance of class A is used here)
print a.name
print A.name
prints:
B
A
if instead in point 1 I use class name, output is different:
A.name = 'B' # point 1 (updated, class A itself is...
When making a django request through json as,
var info=id + "##" +name+"##"
$.post("/supervise/activity/" + info ,[] ,
function Handler(data,arr)
{
}
In urls.py
(r'^activity/(?P<info>\d+)/$, 'activity'),
In views,
def activity(request,info):
print info
The request does not go through.info is a string.How can th...
I am trying to output a XML file using Python and lxml
However, I notice one thing that if a tag has no text, it does not close itself. An example of this would be:
root = etree.Element('document')
rootTree = etree.ElementTree(root)
firstChild = etree.SubElement(root, 'test')
The output of this is:
<document>
<test/>
</document
I ...
Hey, I'm totally behind this topic.
Yesterday I was doing profiling using Python profiler module for some script I'm working on, and the unit for time spent was a 'CPU second'. Can anyone remind me with the definition of it?
For example for some profiling I got: 200.750 CPU seconds. What does that supposed to mean? At other case and fo...
Hello. I have such db model:
from datetime import datetime
class TermPayment(models.Model):
dev_session = models.ForeignKey(DeviceSession, related_name='payments')
user_session = models.ForeignKey(UserSession, related_name='payment')
date = models.DateTimeField(default=datetime.now(),blank=True)
sum = models.FloatFi...
In my views i have the date in the following format s_date=20090106 and e_date=20100106
The model is defined as
class Activity(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
how to query for the timestamp filed with the above info.
Activity.objects.filter(timestamp>=s_date and timestamp<=e_date...
Well, when I'm trying to use 'inclusion' in Django, I met some confused problems that I can't solve it by myself.
There is the structures for my project.
MyProject---
App1---
__init__.py
models.py
test.py
urls.py
views.py
...
I wonder when to use what flavour of Python 3 super().
Help on class super in module builtins:
class super(object)
| super() -> same as super(__class__, <first argument>)
| super(type) -> unbound super object
| super(type, obj) -> bound super object; requires isinstance(obj, type)
| super(type, type2) -> bound super object; re...
I need to create Client/Server application to send files from clients to Server.
I use simple ssl sockets for that and authenticate with certificates.
ms = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl_sock = ssl.wrap_socket(ms,
keyfile=".../newCA/my_client.key",
certfile="...
Hi all,
I'm trying to modify a header using Middleware in Pylons to make my application RESTful, basically, if the user request "application/json" via GET that is what he get back.
The question I have is, the variable headers is basically a long list. Looking something like this:
[('Content-Type', 'text/html; charset=utf-8'), ('Pragma...
I am using SUDS to access a SOAP server. When I run the script directly, I have no problems. If I use nosetest to run the script, the connection to the server fails:
Traceback (most recent call last):
File "c:\python25\lib\site-packages\nose-0.11.3-py2.5.egg\nose\suite.py", line 197, in run
self.setUp()
File "c:\python25\lib\si...
import math
def gen_caller(a):
for z in a:
x,y=z
if x==1:
x=2
if y>=x and y-x<=100000:
for i in range(x,y+1):
flag=0
for j in range(2,(long(math.sqrt(i))+1)):
...