I'd like some help interpreting this binary file.
|

|
Wow you're good! :p
That bmp would be the loading art associated with the beginning of the note chart. I'll have to check out those programs. This should help A LOT.
Any idea how those programs work
|
|
Posted On: Friday 28th of December 2012 05:24:48 AM |
Total Views:
177 |
View Complete with Replies
|
|
RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE
|
|

|
|

|
|

|
is there any tutorial for super method (when/how to use it)
or maybe someone could explain me how it works
thx... |

|
VIEWS ON THIS POST
32
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
I've built an app on linux which we have managed to localise into at
least three languages, the app runs well using this command LANG=fr_FR
python app.py which would translate the app into french. We've tried
the replicate the same ... |

|
VIEWS ON THIS POST
24
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
On Wed, 2008-03-26 at 23:04 +0100, Micha\t Bentkowski wrote:
> Why does python create a reference here, not just copy the variable
Python, like most other oo languages, will always make references for =,
unless you work on native types ... |

|
VIEWS ON THIS POST
75
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
Our regular PyGTA meeting will be occurring for those not at the PyCon
sprints. We'll meet at the regular time (7pm) at the regular place
(Linux Caffe, on the corner of Grace and Harbord).
Topic:
Using Core Image (GL-based Mac ... |

|
VIEWS ON THIS POST
40
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
Laszlo Nagy wrote:
> The program below gives me "segmentation fault (core dumped)".
>
> Environment:
> Linux gandalf-desktop 2.6.20-16-generic #2 SMP Tue Feb 12 05:41:34
> UTC 2008 i686 GNU/Linux
> Python 2.5.1
>
> What is wrong with ... |

|
VIEWS ON THIS POST
32
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
what would be a good means of finding where the 0.11 version of
edgewall trac uses excessive memory. see
http://groups.google.com/group/trac-...16e519da54f16b
for some details, where jonas suggested
http://wingolog.org/archives/2007/11...n-applications
as reading.
tiran already gave some hints on http://bugs.python.org/issue1871 , but
also suggested ... |

|
VIEWS ON THIS POST
65
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
As has occurred since the inception of PyCon, there will be a sprint
on the Python core at this year's conference!
If you will be attending PyCon (or will be in Chicago during the dates
of the sprints), attending the ... |

|
VIEWS ON THIS POST
34
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
That seems interesting but it's not quite what I want to do. To take
an example I would like to be able to do something similar to the
mysql shell when its pager is set to less. Displayhook is called
... |

|
VIEWS ON THIS POST
47
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
On Jan 12, 2008 10:13 AM, Jorgen Bodde wrote:
> I thought about that too. I just wonder why /usr/local/bin is always
> empty and every .deb I install from a source (if it's from Ubuntu or
> not) ... |

|
VIEWS ON THIS POST
69
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
Cdric Lucantis wrote:
> I can only load gif images with Tkinter.PhotoImage and none with BitmapImage.
> I tried png, jpg, bmp and xpm and always got this errors :
>
>>>> img = Tkinter.PhotoImage(file='/home/omer/fgfs/fgsync/map.xpm')
> Traceback (most recent call ... |

|
VIEWS ON THIS POST
29
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
!
I'm pleased to announce the 0.7.10 release of SQLObject.
What is SQLObject
=================
SQLObject is an object-relational mapper. Your database tables are described
as classes, and rows are instances of those classes. SQLObject is meant to be
easy to ... |

|
VIEWS ON THIS POST
31
|

|
Posted on:
Sunday 25th November 2012
|
View Replies!
|
|

|
|

|
,
Would anyone know how to generate thumbnails with rounded corners
using PIL I'm also considering imagemagick if PIL turns out not to be
appropriate for the task.
Thank you so much,
Alex... |

|
VIEWS ON THIS POST
32
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
Hi list,
Firstly, this is my first post here, so I hope I'm not breaking some
unwritten etiquette rule about asking questions involving several
different libraries.
I'm trying to plug some memory leaks in a TurboGears program. We (the
Fedora ... |

|
VIEWS ON THIS POST
24
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
I am working on processing eml email message using the email module (python
2.5), on files exported from an Outlook PST file, to extract the composite
parts of the email. In most instances this works fine, the message is read
... |

|
VIEWS ON THIS POST
25
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
Recently, I got into a debate on programming.reddit.com about
what should happen in the following case:
>>> a = ([1], 2)
>>> a[0] += [3]
Currently, Python raises an error *and* changes the first element of
the tuple. Now, this ... |

|
VIEWS ON THIS POST
21
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
I am starting to experiment with ctypes. I have a function which returns a
pointer to a struct allocated in heap memory. There is a corresponding free
function for that sort of struct, e.g.:
from ctypes import *
cdll.LoadLibrary("libthing.so")
c_thing ... |

|
VIEWS ON THIS POST
33
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
I'm new to python, but I have used a fair bit of C and Perl
I found Perls regex's to be very easy to use however I don't find
Pythons regexes as good.
I am trying to do ... |

|
VIEWS ON THIS POST
41
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
I'm having great fun playing with Markov chains. I am making a
dictionary of all the words in a given string, getting a count of how
many appearances word1 makes in the string, getting a list of all the
word2s ... |

|
VIEWS ON THIS POST
44
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
Hi all,
The IPython team is happy to release version 0.8.2, with lots of new
enhancements (especially for system shell use - it has never been a
better time
for switching to "pysh" or "ipython -p sh" as your system ... |

|
VIEWS ON THIS POST
50
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
"David Coffin" wrote in message
news:95d1d5660711290359s40274b40tb84415cc006c0001@mail.gmail.com...
| Is it possible to add an attribute to a new style class where the name of
| that attribute is determined at runtime
>>> class C(object): pass
>>> setattr(C,'a',1)
>>> C.a
1
... |

|
VIEWS ON THIS POST
50
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
On 11/23/07, kyo guan (kyoguan@gmail.com) wrote:
> Please look at this code:
>
>>>> 'exe.torrent'.rstrip('.torrent')
>'ex' <----- it should be 'exe', why
>
>but this is a right answer:
>
>>>> '120.exe'.rstrip('.exe')
>'120' <------ this is a right value.
>
... |

|
VIEWS ON THIS POST
39
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
In our company we are looking for one language to be used as default
language. So far Python looks like a good choice (slacking behind
Java). A few requirements that the language should be able cope with
are:
* Database ... |

|
VIEWS ON THIS POST
30
|

|
Posted on:
Monday 26th November 2012
|
View Replies!
|
|

|
|

|
Basically this is a final project for my programming class. What I am having trouble with is the totalBudget variable. I had to initially set it to 4000 per instructions given. The user is supposed to adjust this via a menu option and go back to the main menu for possible other selections. The program works, except after the user adjusts the totalBudget and goes back to the main menu, totalBudget is reset to the initial 4000. Any help would be greatly appreciated. Thank you for your time.
Python Syntax (Toggle Plain Text) def main(): choice = 0 totalBudget = 4000.00\t while choice != 5: print print 'Menu Selections:' print print '1 - Add an Expense' print '2 - Remove an Expense' print '3 - Add Revenue' print '4 - Remove Revenue' print '5 - Exit' print choice = input('Enter your selection: ') if choice == 1: addExpense(totalBudget) elif choice == 2: removeExpense(totalBudget) elif choice == 3: addRevenue(totalBudget) elif choice == 4: removeRevenue(totalBudget) elif choice == 5: print 'Goodbye!' else: print print 'Invalid input - please try again.' print#This function adds an expensedef addExpense(totalBudget): newExpense = input('Enter the amount of the expense: ') expenseFrequency = input('Enter how many times the expense was applied in the month: ') totalExpense = newExpense * expenseFrequency if totalExpense |

|
VIEWS ON THIS POST
153
|

|
Posted on:
Tuesday 27th November 2012
|
View Replies!
|
|

|
|

|
Could someone look this over
(Toggle Plain Text) #import whrandom
def start():
answer=randint(1,101) #the answer
guessnum=0 #number of user guesses
guess=raw_imput ('guess my number, it is between 1 and 100') #user's guess
while guess!= answer:
guessnum=guessnum+1
if(guess = 101):
print'no the answer is below 101'
elif (guess > answer):
print 'Too high'
elif (guess answer):
print 'Too high'
elif (guess |

|
VIEWS ON THIS POST
44
|

|
Posted on:
Tuesday 27th November 2012
|
View Replies!
|
|

|
|

|
I have recently been reading "Dive into Python" written by Mark Pilgrim. I haven't read it all but it is excellent and very well written. And I'd recommend it to those who want to learn Python or improve their Python skills. I was told abotu it quite some time ago, but i never thought twice about it, but now i've read it i realise i was missing out.
The book can be bought here: http://www.amazon.com/gp/product/159...books&v=glance
Or read online for free here: http://diveintopython.org/toc/index.html
Its availible for free online because its under the GNU Free Documentation License.
I think it does start quite steeply, so it could be hard on those wanting to learn Python as their first language. But for programmers it is very informative and well written.
Each chapter/section starts with a block of code which hasn't been explained, then throughout the chapter each part is explained, which i find quite useful.
Well thats just my opinion. I basically posted this just to make some people aware of it.
Have fun with it.
-ColdDeath |

|
VIEWS ON THIS POST
39
|

|
Posted on:
Tuesday 27th November 2012
|
View Replies!
|
|

|
|

|
If anyone is interested, and doesn't mind downloading 60 megs, PM me. It's just a small bit of the RPG, with missing character graphics. lol
I need to test how compatable it is, and if it runs smoothly enough (before I get too far and find out I need to change how I'm doing things). I've fixed the problem of needing to rapidly press the arrow keys, but it's not in the updated zip.
|

|
VIEWS ON THIS POST
27
|

|
Posted on:
Tuesday 27th November 2012
|
View Replies!
|
|

|
|

|
I am trying to run a Python sample that contains the line
from Numeric import *
The error basically tells me to get the module called Numeric. Can somebody please tell me where to download it from. I am using Python24. |

|
VIEWS ON THIS POST
27
|

|
Posted on:
Tuesday 27th November 2012
|
View Replies!
|
|

|
|

|
Ok
How can I tell python that you have a text file. In this file, start from the beginning of the first line. Then, if you finy ant " " empty char., count one ane increment the counter whenever you find that empty char. and do the same process for the other line until we get the total number of tokens in the file. Also, whenever you find any of(".", "","!" ... etc) count the number of tokens of precede it, which is of course the length of that sentence.
--black_dream |

|
VIEWS ON THIS POST
22
|

|
Posted on:
Tuesday 27th November 2012
|
View Replies!
|
|

|
|

|
I need someone to give me a small program not too difficult for beginners. Like give me a problem or something that relates to if, elif, else, return statements. Some for and while loops. Maybe some data structures. The basics.
I am going to need some practice for a big test I am going to take.
So if anyone has any, please give me some problems to program for beginners. |

|
VIEWS ON THIS POST
26
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
I'm a novice who wants to dedicate his life to the study of networks, computer systems, and for starters the python programming language amung others.
If there are any tips you could give someone of my proficiency level in terms of mastering these subjects it would be much appreciated. |

|
VIEWS ON THIS POST
27
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
Quote:
Originally Posted by Dietrich
ActiveState pushes the Komodo IDE, but you have to download it separately:
http://www.activestate.com/komodo-ide/downloads
Python syntax might be easy to learn, but to write programs past the Kindergarten level, you have to study hard.
Of course, you could be a real Klingon programmer and program with binary toggle switches on the front panel of your computer!
nah, im not going to pay for an ide thx. |

|
VIEWS ON THIS POST
39
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
Good Evening ,
I'm doing a small application using python and MySQLdb. I want to check the special characters with ASCII values with the given characters in the text box.
string1 = user name.
string2 = password.
if(string1.rindex!="char(32)" and string2.rindex!="char(32)")
message("You Have Enbtered Special Characters.")
else
check the values from the database and process will follow.
|

|
VIEWS ON THIS POST
25
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
first and foremost, hi!
I had a program a long time ago that used to track snippits of websites, just text, and display them, almost like an rss reader would, but you didn't need an rss, you just fed it 2 bits of the source code and it would grab whatever was between them.
I miss this program greatly, can't find anything like it so I though what the hey, I'll see if I can make one. I've done programming on an off through the years, I took a couple VB classes, I've coded java, tcl/tk, a little php, and I did a lot of coding in IRC back in the day, I know I know it's not really a language, but I wasn't doing basic macros in it, I used to make those really large elaborate scripts people downloaded... anyways, it's fair to say I know what I'm doing, but I'm not well versed in any one language.
the ui of the program would be simple, no biggy there, but I've never made a program that calls to the internet, or grabs webpages or anything of the sort.
it seems like it should be fairly easy, I'm wondering what language would be good for something simple as this I'm very quick to pickup new languages, taught myself all the of the above in about a 1-3 days so anything new is fine.
any input would be great. |

|
VIEWS ON THIS POST
46
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
I have a small problem with lists in python. I need ot know the best way to effectively delete an item from a list. For example, take the following list:
list = ["One", "Two", "Three", "Four"]
I want to delete, say, the number two. What i currently do is:
count = -1
for number in list:
count +=1
if number = "Two":
break
del list[count]
It works for me, but i'm wondering if there is a less clunky way to perform the same operation. |

|
VIEWS ON THIS POST
27
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
I have written a python code for quadratic formula . However, I need both real and complex numbers for my results. I have done research and noticed two differences: real numbers uses import math and complex numbers uses import cmath
Here's my code. I would like to know what I have done wrong. I have even put my comments on there:
(Toggle Plain Text) # quadraticcomplex.py
# A program that computes the complex roots of a quadratic equation.
# Illustrates use of the cmath library.
# The presence of complex numbers also requires mathematical functions that can perform operations on them.
# The imaginary component of a complex number is denoted by a suffix of ``J'' or ``j'';
import cmath # Makes the cmath library available.
def main(): # beginning of the code
print "! This program finds the complex solutions to a quadratic"
print
a, b, c = input("Please enter the coefficients (a, b, c): ")
discRoot = cmath.sqrt(b * b - 4 * a * c) # formula solving discriminant
root1 = (-b + discRoot) / (2 * a) # formula solving root1
root2 = (-b - discRoot) / (2 * a) # formula solving root2
print
print "The solutions are:", root1, root2 # display the results
main() # end of the code # quadraticcomplex.py
# A program that computes the complex roots of a quadratic equation.
# Illustrates use of the cmath library.
# The presence of complex numbers also requires mathematical functions that can perform operations on them.
# The imaginary component of a complex number is denoted by a suffix of ``J'' or ``j'';
import cmath # Makes the cmath library available.
def main(): # beginning of the code
print "! This program finds the complex solutions to a quadratic"
print
a, b, c = input("Please enter the coefficients (a, b, c): ")
discRoot = cmath.sqrt(b * b - 4 * a * c) # formula solving discriminant
root1 = (-b + discRoot) / (2 * a) # formula solving root1
root2 = (-b - discRoot) / (2 * a) # formula solving root2
print
print "The solutions are:", root1, root2 # display the results
main() # end of the code |

|
VIEWS ON THIS POST
47
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
Quote:
Originally Posted by arranta
Thank you very much. I'll check it out in a moment. There is one concern I've got. What is enumerate function and how to check out if I have it
The enumerate function is probably best expressed with an example. This is a normal for loop:
(Toggle Plain Text) list = ["a", "b", "c"]
for letter in list:
print letter list = ["a", "b", "c"]
for letter in list:
print letter |

|
VIEWS ON THIS POST
49
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
Everyonce in a while I'll decide to put down my RPG for an hour and program something completely pointless. I'll post all that I do during those periods, here:
MSN ASCII GENERATOR
(Toggle Plain Text) def display(x,y):
print
for a in range(len(x)):
for b in range(len(x[a])):
if x[a][b]==" ":y.append(blank)
elif x[a][b]=="#":y.append(fill)
print"".join(y);y=[]
print
a=raw_input("Load or Draw Your Design (L/D) ")
if a=="D" or a=="d":
display(x,[]);a=raw_input("Save (Y/N) ")
if a=="Y" or a=="y":print;b=input("Save Slot ");the_file=open("designs_"+str(b),'w');the_text="("+str(b)+") "+str(x);the_file.write(the_text)
else:
print;b=input("Load Slot Number ");the_file=open("designs_"+str(b),'r');the_contents=the_file.read();r=[]
for c in range(len(the_contents)):
if the_contents[c:c+len(str(b))]==str(b):r.append(c)
elif the_contents[c:c+len(str(b))]==int:r.append(c)
if len(r)==1:r.append(len(the_contents));x=[];f=[]
for a in range(len(the_contents[r[0]+4+len(str(b)):r[1]-2])):
if the_contents[r[0]+4+len(str(b))+a]=="'":f.append(a)
x.append(the_contents[r[0]+4+len(str(b)):r[0]+4+len(str(b))+f[0]])
for a in range(1,len(f)):
if a%2==0:x.append(the_contents[r[0]+5+len(str(b))+f[a-1]:r[0]+4+len(str(b))+f[a]])
x.append(the_contents[r[0]+5+len(str(b))+f[len(f)-1]:r[1]-2])
if r!=[]:display(x,[]) def display(x,y):
print
for a in range(len(x)):
for b in range(len(x[a])):
if x[a][b]==" ":y.append(blank)
elif x[a][b]=="#":y.append(fill)
print"".join(y);y=[]
print
a=raw_input("Load or Draw Your Design (L/D) ")
if a=="D" or a=="d":
display(x,[]);a=raw_input("Save (Y/N) ")
if a=="Y" or a=="y":print;b=input("Save Slot ");the_file=open("designs_"+str(b),'w');the_text="("+str(b)+") "+str(x);the_file.write(the_text)
else:
print;b=input("Load Slot Number ");the_file=open("designs_"+str(b),'r');the_contents=the_file.read();r=[]
for c in range(len(the_contents)):
if the_contents[c:c+len(str(b))]==str(b):r.append(c)
elif the_contents[c:c+len(str(b))]==int:r.append(c)
if len(r)==1:r.append(len(the_contents));x=[];f=[]
for a in range(len(the_contents[r[0]+4+len(str(b)):r[1]-2])):
if the_contents[r[0]+4+len(str(b))+a]=="'":f.append(a)
x.append(the_contents[r[0]+4+len(str(b)):r[0]+4+len(str(b))+f[0]])
for a in range(1,len(f)):
if a%2==0:x.append(the_contents[r[0]+5+len(str(b))+f[a-1]:r[0]+4+len(str(b))+f[a]])
x.append(the_contents[r[0]+5+len(str(b))+f[len(f)-1]:r[1]-2])
if r!=[]:display(x,[]) |

|
VIEWS ON THIS POST
47
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
Quote:
I've been hunting around, and everything seems to indicate that there should be nothing wrong with my code
Very bad assumption to make . Just because you can't see the problem, doesn't mean that it's not there.
Eh... you're passing a method (fileObj.write) to a function that wants a file object as its parameter.
storlines takes a command and a file object, retrlines take a command and a callback. You must have mistaken them somehow.
A little advice: Look at the trackback. It'll show you what you're passing to what function. Cross reference that with the Python documentation, and you can't go wrong. |

|
VIEWS ON THIS POST
68
|

|
Posted on:
Wednesday 28th November 2012
|
View Replies!
|
|

|
|

|
Everytime I try to run a static text program using the wx.Python commands the new window appears, a little gray section where the text should be appears, but then it freezes and won't respond. I've run the program minus the text and it all appears fine, but once I add the static text script it locks up.
It ran perfectly fine a couple of times, then I tried using colour custom static text and it froze. Now it won't run static text at all, even if it's not custom. Anyone know how to resolve this |

|
VIEWS ON THIS POST
46
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
Quote:
Originally Posted by public2
We're learning Python AND Java, and the integration between them, but in this first semester, we just learned Python. Baby steps :-)
That sounds like an interesting approach to computer programming. Are you also going to use Jython
Let us know how you are doing! |

|
VIEWS ON THIS POST
53
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
So... why were you giving me a hard time about it |

|
VIEWS ON THIS POST
36
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
First of all, if you're new to programming and the real world, you almost certainly have the wrong ideas about application development, performance tuning, efficient coding, and the whys and wherefores thereof. That isn't intended to be a mortal insult, but the probability of it being true is very high. I would recommend that you visit this link. The paths that you choose to think-walk might be more productive.
As an example, I am currently messing around with porting some image-analysis code to Python (from C/C++). On my first shot, it took 5-10 seconds to load the file and 10-15 seconds to process it. Those relative times have no bearing on where performance issues need to be addressed. The file loading process is: pick the file menu; pick the open option; pick the directory; pick the file; pick my nose; pick OK. Honing those actions, especially picking my nose, is not the path to success. The file is picked once. The image is processed with a function FOR EACH PIXEL. That process may involve accessing multiple pixels for each pixel. Obviously, it can get out of hand. When you have an idea that some section of code is critical, you may be right. Find out. Profile the code. Here is a sample profile (made AFTER I cut the time in half by switching image libraries).
(Toggle Plain Text) ncalls tottime percall cumtime percall filename:lineno(function)
1 1.691 1.691 11.567 11.567 Filter.py:332(SobelEdge3)
15876 1.562 0.000 2.268 0.000 Filter.py:38(gradient)
15876 1.035 0.000 2.978 0.000 Image.py:670(crop)
16384 0.775 0.000 2.009 0.000 ImageDraw.py:133(_getink)
16384 0.747 0.000 3.138 0.000 ImageDraw.py:226(point)
15880 0.732 0.000 0.943 0.000 ImageFile.py:115(load)
15876 0.701 0.000 1.001 0.000 Image.py:1546(__init__)
15876 0.546 0.000 0.546 0.000 :0(crop)
16390 0.524 0.000 0.923 0.000 Image.py:79(isStringType)
15876 0.488 0.000 1.490 0.000 Image.py:793(getdata)
15876 0.456 0.000 1.002 0.000 Image.py:1563(load)
15879 0.407 0.000 0.407 0.000 :0(range)
32788 0.399 0.000 0.399 0.000 :0(isinstance)
16384 0.381 0.000 0.381 0.000 :0(draw_points)
16385 0.312 0.000 0.312 0.000 :0(draw_ink)
15894 0.301 0.000 0.301 0.000 Image.py:392(__init__)
15876 0.300 0.000 0.300 0.000 :0(sqrt)
15892 0.211 0.000 0.211 0.000 Image.py:525(load) ncalls tottime percall cumtime percall filename:lineno(function)
1 1.691 1.691 11.567 11.567 Filter.py:332(SobelEdge3)
15876 1.562 0.000 2.268 0.000 Filter.py:38(gradient)
15876 1.035 0.000 2.978 0.000 Image.py:670(crop)
16384 0.775 0.000 2.009 0.000 ImageDraw.py:133(_getink)
16384 0.747 0.000 3.138 0.000 ImageDraw.py:226(point)
15880 0.732 0.000 0.943 0.000 ImageFile.py:115(load)
15876 0.701 0.000 1.001 0.000 Image.py:1546(__init__)
15876 0.546 0.000 0.546 0.000 :0(crop)
16390 0.524 0.000 0.923 0.000 Image.py:79(isStringType)
15876 0.488 0.000 1.490 0.000 Image.py:793(getdata)
15876 0.456 0.000 1.002 0.000 Image.py:1563(load)
15879 0.407 0.000 0.407 0.000 :0(range)
32788 0.399 0.000 0.399 0.000 :0(isinstance)
16384 0.381 0.000 0.381 0.000 :0(draw_points)
16385 0.312 0.000 0.312 0.000 :0(draw_ink)
15894 0.301 0.000 0.301 0.000 Image.py:392(__init__)
15876 0.300 0.000 0.300 0.000 :0(sqrt)
15892 0.211 0.000 0.211 0.000 Image.py:525(load) |

|
VIEWS ON THIS POST
57
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
Is there a way to suppress output to stdout in Python I am importing a module written by someone else that I do not want to modify which prints status messages while it is running. Is there an easy way to prevent these messages from being printed, then allowing my program to print its own messages I assume the solution to this would be to redirect stdout, which I might look into, but is that the easiest/standard way to do this |

|
VIEWS ON THIS POST
32
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
K, I'm a complete noob when it comes to python. I have no experience in it what-so-ever. So you might be getting a lot of these posts from me... little lame things...
Now, how do you keep a python window open When I do the print command, it doesn't stay open. Noobular, I know... but still. How |

|
VIEWS ON THIS POST
59
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
all, i just read that if you make a list of ints, python will allocate a QUADWORD per element in the list! I mean, i've got a gig of ram, but a quadword what the heck does it do with all that space Seems like most of it MUST go to waste.
I'm not super concerned about memory effeciency in most of the stuff i'd write in python, but thats not just ineffecient, its downright wasteful. Anyone know why its designed this way Also, if anyone knows of any good documentation that describes the python internals (and maybe some of the logic behind them) i'd love to see it, i havent found much about hacking the internals in python.
|

|
VIEWS ON THIS POST
31
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
Is there anyway for this to happen
At the moment, I am working on a little text adventure. I have also recently discovered the joy of functions, but they have one problem; they can't return a value for a global variable!
The following code is a test for a question system I am making for my text adventure game.
At the moment, I want my function to give a value for "answer".
(Toggle Plain Text) inventory = [ "cat" , "gun" , "wallet" , "condom" ]
answer = 0
def questions(q,ansone,anstwo,ansoneres,anstwores,ansunknown):
questionloop = 0
while questionloop != 3:
ans = raw_input(q)
if ans == "inven":
print inventory
elif ans == ansone:
print ansoneres
questionloop = 3
answer = 1
elif ans == anstwo:
print anstwores
questionloop = 3
answer = 2
else:
print ansunknown
questions("Where is my cat! :","dead","alive","NOOOOOOOO!","THANK GOD!","WTF!")
if answer == 1:
print " answer equals 1, the story will continue with this path."
elif answer == 2:
print " answer equals 2, the story will continue with this path."
else:
print "no one is going to ever see this text. HAHAHAHAHA!" inventory = [ "cat" , "gun" , "wallet" , "condom" ]
answer = 0
def questions(q,ansone,anstwo,ansoneres,anstwores,ansunknown):
questionloop = 0
while questionloop != 3:
ans = raw_input(q)
if ans == "inven":
print inventory
elif ans == ansone:
print ansoneres
questionloop = 3
answer = 1
elif ans == anstwo:
print anstwores
questionloop = 3
answer = 2
else:
print ansunknown
questions("Where is my cat! :","dead","alive","NOOOOOOOO!","THANK GOD!","WTF!")
if answer == 1:
print " answer equals 1, the story will continue with this path."
elif answer == 2:
print " answer equals 2, the story will continue with this path."
else:
print "no one is going to ever see this text. HAHAHAHAHA!" |

|
VIEWS ON THIS POST
44
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
I have a program that is intended to record and playback arrow keys and space bar input exactly how they were pressed and at what time.
But I need it to be more precise/accurate/consistent, rather then just recording the number of empty loops in between each change... help please
main.py
(Toggle Plain Text) from win32api import *
from win32con import *
from time import sleep
def Record(filename):
save = []
done = False
lGate = False
rGate = False
dGate = False
uGate = False
sGate = False
b = -1
print 'Press Enter When Ready ...\nPress Escape To End'
while not GetAsyncKeyState(VK_RETURN):' '
while not done:
if GetAsyncKeyState(VK_LEFT):
if not lGate:
save.append(str(b)+'c') ; b = 0
lGate = True
save.append( "37a" )
elif lGate:
save.append(str(b)+'c') ; b = 0
lGate = False
save.append( "37b" )
if GetAsyncKeyState(VK_RIGHT):
if not rGate:
save.append(str(b)+'c') ; b = 0
rGate = True
save.append( "39a" )
elif rGate:
save.append(str(b)+'c') ; b = 0
rGate = False
save.append( "39b" )
if GetAsyncKeyState(VK_UP):
if not uGate:
save.append(str(b)+'c') ; b = 0
uGate = True
save.append( "38a" )
elif uGate:
save.append(str(b)+'c') ; b = 0
uGate = False
save.append( "38b" )
if GetAsyncKeyState(VK_DOWN):
if not dGate:
save.append(str(b)+'c') ; b = 0
dGate = True
save.append( "40a" )
elif dGate:
save.append(str(b)+'c') ; b = 0
dGate = False
save.append( "40b" )
if GetAsyncKeyState(VK_SPACE):
if not sGate:
save.append(str(b)+'c') ; b = 0
sGate = True
save.append( "32a" )
elif sGate:
save.append(str(b)+'c') ; b = 0
sGate = False
save.append( "32b" )
if GetAsyncKeyState(VK_ESCAPE):
done = True
if b + 1: b += 1
file = open(filename, 'w')
file.write( ''.join(save)[3:] )
file.close()
def Play(file, interval):
data = open(file, 'r').read()
r = []
a,o = 0,0
while a < len(data):
if data[a] == 'a':
r += ['keybd_event(%s, 0, KEYEVENTF_EXTENDEDKEY, 0)'%(data[o:a])]
o = a + 1
elif data[a] == 'b':
r += ['keybd_event(%s, 0, KEYEVENTF_KEYUP, 0)'%(data[o:a])]
o = a + 1
elif data[a] == 'c':
r += [ 'sleep( %s )' % ( float(int(data[o:a])) / float(interval)) ]
o = a + 1
a += 1
print 'Press Enter When Ready ...\nPress Escape To End'
while not GetAsyncKeyState(VK_RETURN):''
for event in r:
exec event
if GetAsyncKeyState(VK_ESCAPE): break
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_UP, 0, KEYEVENTF_KEYUP, 0) #reset keys
keybd_event(VK_DOWN, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0)
#Record('sample.sKey')
#Play('sample.sKey', 48500)
#shorter the interval = longer wait between movements (greater distance)
#bigger the interval = smaller wait between movements (lesser distance) from win32api import *
from win32con import *
from time import sleep
def Record(filename):
save = []
done = False
lGate = False
rGate = False
dGate = False
uGate = False
sGate = False
b = -1
print 'Press Enter When Ready ...\nPress Escape To End'
while not GetAsyncKeyState(VK_RETURN):' '
while not done:
if GetAsyncKeyState(VK_LEFT):
if not lGate:
save.append(str(b)+'c') ; b = 0
lGate = True
save.append( "37a" )
elif lGate:
save.append(str(b)+'c') ; b = 0
lGate = False
save.append( "37b" )
if GetAsyncKeyState(VK_RIGHT):
if not rGate:
save.append(str(b)+'c') ; b = 0
rGate = True
save.append( "39a" )
elif rGate:
save.append(str(b)+'c') ; b = 0
rGate = False
save.append( "39b" )
if GetAsyncKeyState(VK_UP):
if not uGate:
save.append(str(b)+'c') ; b = 0
uGate = True
save.append( "38a" )
elif uGate:
save.append(str(b)+'c') ; b = 0
uGate = False
save.append( "38b" )
if GetAsyncKeyState(VK_DOWN):
if not dGate:
save.append(str(b)+'c') ; b = 0
dGate = True
save.append( "40a" )
elif dGate:
save.append(str(b)+'c') ; b = 0
dGate = False
save.append( "40b" )
if GetAsyncKeyState(VK_SPACE):
if not sGate:
save.append(str(b)+'c') ; b = 0
sGate = True
save.append( "32a" )
elif sGate:
save.append(str(b)+'c') ; b = 0
sGate = False
save.append( "32b" )
if GetAsyncKeyState(VK_ESCAPE):
done = True
if b + 1: b += 1
file = open(filename, 'w')
file.write( ''.join(save)[3:] )
file.close()
def Play(file, interval):
data = open(file, 'r').read()
r = []
a,o = 0,0
while a < len(data):
if data[a] == 'a':
r += ['keybd_event(%s, 0, KEYEVENTF_EXTENDEDKEY, 0)'%(data[o:a])]
o = a + 1
elif data[a] == 'b':
r += ['keybd_event(%s, 0, KEYEVENTF_KEYUP, 0)'%(data[o:a])]
o = a + 1
elif data[a] == 'c':
r += [ 'sleep( %s )' % ( float(int(data[o:a])) / float(interval)) ]
o = a + 1
a += 1
print 'Press Enter When Ready ...\nPress Escape To End'
while not GetAsyncKeyState(VK_RETURN):''
for event in r:
exec event
if GetAsyncKeyState(VK_ESCAPE): break
keybd_event(VK_LEFT, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_UP, 0, KEYEVENTF_KEYUP, 0) #reset keys
keybd_event(VK_DOWN, 0, KEYEVENTF_KEYUP, 0)
keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0)
#Record('sample.sKey')
#Play('sample.sKey', 48500)
#shorter the interval = longer wait between movements (greater distance)
#bigger the interval = smaller wait between movements (lesser distance) |

|
VIEWS ON THIS POST
49
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
all,
I am new to programming, (new may be an understatement), and I have an idea. The problem is I have no clue where to start! I want to design a GUI that ties to a windows driver and multiple viewers. Basically a GUI that will browse all files on a PC, let the user select those files, view them first if they would like, then submit to the windows printer driver queue. Ive gone through many python tutorials, but honestly have no clue where to start. |

|
VIEWS ON THIS POST
44
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
I am writing a program that needs to keep track of a large number of files on a hard drive. The files will be stored as absolute paths (eg, /path/to/file.txt). Each time it is run, it may find new files. I want to store the paths to new files as well as paths to files it found when run previously, including files that are no longer found. Is there an easy way to store these paths so that there will not be duplicates Would this be a good use for the shelve module, or is there a better way to do this |

|
VIEWS ON THIS POST
41
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|
|

|
I have been learning Python for a while now. I was browsing old posts in this forum and stumbled across this thread in which Arevos posted the following code:
(Toggle Plain Text) def permutations(x):
if len(x) |

|
VIEWS ON THIS POST
68
|

|
Posted on:
Friday 28th December 2012
|
View Replies!
|
|

|