I'm having problems making a top level widget fade in, in TKinter. For some reason the widget doesn't fade in at all, then it will show up in the taskbar, but only after clicking the button that runs this command twice (it's not supposed to be in the taskbar).
The code responsible for these problems.
Alpha = 0.0
w1.attributes(...
i am working with lists, and there is a function that is returning something that looks like this:
array([0, 5, 3, 3, 0, 1, 2])
how do i cast those values into a list?
what does array mean?
...
a = {"a":"çö"}
b = "çö"
a['a']
>>> '\xc3\xa7\xc3\xb6'
b.decode('utf-8') == a['a']
>>> False
What is going in there?
edit= I'm sorry, it was my mistake. It is still False. I'm using Python 2.6 on Ubuntu 10.04.
...
Question: In command line, how do I call a python script with out having to type "python" before the script? is this even possible?
Info:
I wrote a handy script for accessing sqlite databases from command line, but I kind of don't like having to type "python SQLsap args" and would rather just type "SQLsap args". I don't know if this ...
I'm writing some python code to interact with a C DLL that uses structures extensively.
One of those structures contains nested structures. I know that this is not a problem for the ctypes module. The problem is that there is an often used structure that, in C, is defined via macro because it contains an "static" length array that can...
So I have two different files somewhat like this:
file1.py
from file2 import *
foo = "bar";
test = SomeClass();
file2.py
class SomeClass :
def __init__ (self):
global foo;
print foo;
However I cannot seem to get file2 to recognize variables from file1 even though its imported into file1 already. It would be ext...
I'd like to implement my own key command. However when I do, it does both what I tell it and the default command. How do I disable the default command, so that my command is the only one that runs?
This is on Windows 7, BTW.
...
Is there a way to get python to do an evaluation and execution on a string? I have a file which contains a bunch of expressions that need to be calculated, maybe something like this.
f1(ifilter(myfilter,x))
f2(x)*f3(f4(x)+f5(x))
I run through the file and eval the expressions.
Some of the expressions may want to save their work afte...
I'm trying to write a field for django admin that will have 2 widgets: a textinput and an associated checkbox. If the checkbox is checked it will return none, if not return the value of the field. But I can't get the notch of it. Here is how I tried(note I'm new to django):
class FloatRangeField(models.FloatField):
__metaclass__=models...
Hi,
I'm a mechanical engineering student, and I'm building a physical simulation using PyODE.
instead of running everything from one file, I wanted to organize stuff in modules so I had:
main.py
callback.py
helper.py
I ran into problems when I realized that helper.py needed to reference variables from main, but main was the one imp...
how do i convert 45.34531 to 45.3?
...
I find myself doing something like this constantly to pull GET args into vars:
some_var = self.request.get('some_var', None)
other_var = self.request.get('other_var', None)
if None in [some_var, other_var]:
logging.error("some arg was missing in " + self.request.path)
exit()
What I would really want to do is:
pull_args('some_...
Hi,
The contents of my dictionary is like so:-
>>> dict
{'6279': '45', '15752': '47', '5231': '30', '475': '40'}
I tried using the sort function on the keys. I noticed that the sort function doesn't work for the key -- 15752. Please find below:-
>>> [k for k in sorted(dict.keys())]
['15752', '475', '5231', '6279']
Could someone po...
Hey, I'm having some trouble here...
How can I delete an entire text from a field with the sendkeys ?
How can I send the ctrl+shift pressed with the left arrow and delete key after?
edit:
for example, I have this part of the code
ctypes.windll.user32.SetCursorPos(910,475)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0)
...
Hello,
I've scoured various resources and can't figure out how to do a rather simple operation.
Right now, I have a list as follows:
li = [['a=b'],['c=d']]
I want to transform this into:
li = [['a','b'],['c','d']]
As I understand it, split("=") only applies to string types. Is there an equivalent method for lists?
Pardon the si...
for i in range(len(results_histogram)):
if i!=len(results_histogram)-1:
url+=str(results_histogram[i])+','
my if statement is checking whether i am on the last loop, but it is not working. what am i doing wrong?
...
Hi
In my Python app, I'm using events to communicate between different plugins.
Now, instead of registering the methods to the events manually, I thought I might use decorators to do that for me.
I would like to have it look like this:
@events.listento('event.name')
def myClassMethod(self, event)
I have first tried to do it like thi...
I need to produce a time string that matches the iso format yyyy-mm-ddThh:mm:ss.ssssss-ZO:NE. The now() and utcnow() class methods almost do what I want.
>>> import datetime
>>> #time adjusted for current timezone
>>> datetime.datetime.now().isoformat()
'2010-08-03T03:00:00.000000'
>>> #unadjusted UTC time
>>> datetime.datetime.utcnow(...
if i have a very long line of a code, is it possible to continue it on the next line for example:
url='http://chart.apis.google.com/chart?chxl=1:|0|10|100|1,000|10,000|'
+ '100,000|1,000,000&chxp=1,0&chxr=0,0,' +
max(freq) + '300|1,0,3&chxs=0,676767,13.5,0,l,676767|1,676767,13.5,0,l,676767&chxt=y,x&chbh=a,1,0&chs=640x465&cht=bvs&...
I'm writing a c extension to calculate he standard deviation. Performance is important because it will be performed over large data sets. I'm having a hard time figuring out how to get the value of pyobject once I get the item from a list. This is my first time writing a c extension for python and any help is appreciated. Apparently ...