My goal: the user clicks a button. From the button pops up a two-level menu. The user clicks on something, and this triggers a callback which does stuff.
Here is a minimal example:
import wx
class MyApp(wx.App):
def OnInit(self):
frame = TestFrame(None, -1, "Hello from wxPython")
frame.Show(True)
self.Set...
Hello,
I want to load an image, resize it to a given size and after draw it in a specific position in a panel.
All this using wxpython.
How can I do it?
Thanks in advance!
...
Hi folks!!
I have various models of which I would like to keep track and collect statistical data.
The problem is how to store the changes throughout time.
I thought of various alternative:
Storing a log in a TextField, open it and update it every time the model is saved.
Alternatively pickle a list and store it in a TextField.
Save...
What is the proper indentation for Python multiline strings within a function?
def method():
string = """line one
line two
line three"""
or
def method():
string = """line one
line two
line three"""
or something else?
It looks kind of weird to have the string hanging outside the function in t...
Hi,
I'm trying to generate some charts using django-googlecharts. This works fine for rather static data but in one case I would like to render a different number of lines, based on a variable. I tried this:
{% chart %}
{% for line in line_data %}
{% chart-data line %}
{% endfor %}
{% chart-size "390x200" %}
{% chart-...
I recently got bit by a subtle bug.
char ** int2str = {
"zero", // 0
"one", // 1
"two" // 2
"three",// 3
nullptr };
assert( values[1] == "one"_s ); // passes
assert( values[2] == "two"_s ); // fails
If you have godlike code review powers you'll notice I forgot the , after "two".
After the considerable effort to fin...
What is the best way to save a user profile with Google App Engine (Python) ?
What I did to solve this problem is create another Model, with a UserProperty, but requesting the profile from the user I have to do something like this:
if user:
profile = Profile.all().filter('user =', user).fetch(1)
if profile:
property = s....
Hello everyone,
I am building a web-based application. The frontend has been designed in Sproutcore. For the backend, we have our own python API which handles all transactions with multiple databases. What is the best way to hook up the front-end with the back-end.
AFAIK django is pretty monolithic (correct me if i am wrong) and it w...
I'm a .NET developer who knows very little about Python, but want to give it a test drive for a small project I'm working on.
What tools and packages should I install on my machine? I'm looking for a common, somewhat comprehensive, development environment.
I'll likely run Ubuntu 9.10, but I'm flexible. If Windows is a better option, t...
Hi there,
I feel like this is quite delicate,
I have various folders whith projects I would like to backup into a zip/tar file, but would like to avoid backing up files such as pyc files and temporary files.
I also have a Postgres db I need to backup.
Any tips for running this operation as a python script?
Also, would there be an...
I'm trying to create a wx.Menu that will be shared between a popup (called on right-click), and a sub menu accessible from the frame menubar. The following code demonstrates the problem.
If you open the "MENU>submenu" from the menubar the item "asdf" is visible. If you right click on the frame content area, "asdf" will be visible fr...
I'm developing a web application that will require users to either make one time deposits of money into their account, or allow users to sign up for recurring billing each month for a certain amount of money.
I've been looking at various payment gateways, but most (if not all) of them seem complex and difficult to get working. I also se...
OK I've got 2 really big classes > 1k lines each that I currently have split up into multiple ones. They then get recombined using multiple inheritance. Now I'm wondering, if there is any cleaner/better more pythonic way of doing this. Completely factoring them out would result in endless amounts of self.otherself.do_something calls, whi...
Hey im new to python. How do you get a portion of a list by the relative value of its sorting key.
example...
list = [11,12,13,14,15,16,1,2,3,4,5,6,7,8,9,10]
list.sort()
newList = list.split("all numbers that are over 13")
assert newList == [14,15,16]
...
Hi guys,
I have an python error AttributeError: 'module' object has no attribute 'initialize'
I am running Python 2.6.2 on Solaris 10 UNIX and recently installed the pythonldap 2.3.9. The script is very basic, only has these 2 lines. Can anyone tell me why?? Traceback error below.
#!/usr/local/bin/python
import ldap, sys
con = ldap...
I'm working on writing a small WSGI application using Bottle and SqlAlchemy and am confused on how the "layout" of my application should be in terms of SqlAlchemy.
My confusion is with creating engines and sessions. My understanding is that I should only create one engine with the 'create_engine' method. Should I be creating an engine i...
I have a list, let's say, a=[[1,2],[3,4],[5,6]]
I want to add to each item in a the char 'a'.
When I use:
a=[x.append('a') for x in a]
it returns [None,None,None].
But if I use:
a1=[x.append('a') for x in a]
then it does something odd.
a, but not a1 is [[1,2,a],[3,4,a],[5,6,a]].
I don't understand why the first call retur...
My friend says that Django only has 1 thread or something?
And I have to edit my 000-default in order to add more processes? He suggests 4 or 5.
What exactly is this, and what do I have to do?
Thanks, I'm a noob.
...
I am trying to learn django by following along with this tutorial. I am using django version 1.1.1
I run
django-admin.py startproject mysite
and it creates the files it should. Then I try to start the server by running
python manage.py runserver
but here is where I get the following error.
Traceback (most recent call last):
Fil...
Pari/GP is an excellent library for functions relating to number theory. The problem is that there doesn't seem to be an up to date wrapper for python anywhere around, (pari-python uses an old version of pari) and I'm wondering if anyone knows of some other library/wrapper that is similar to pari or one that uses pari.
I'm aware of SAGE...