Re: math equation, svg and matplotlib
André a écrit : Would anyone have a "quick and dirty" code sample to create an svg output of a sample math equation using matplotlib? André Hi André, maybe that's not what you want be there's something like this here (a converter from DVI to SVG in pure Python), look at the samples at the bottom of the page: http://www.wmula.republika.pl/proj/pydvi2svg/index.html#samples -- http://mail.python.org/mailman/listinfo/python-list
Re: Going from Tkinter to pyQT
Alex Bryan a écrit : I had a guy on this mailing list tell me that pyQT is much better than Tkinter, and after looking into it a bit I think he is right. However, I can't find much on it. I want to know if there are any good books or online tutorials that would be helpful. I doubt there is one, but if there is one on going from Tkinter to pyQT, that would be amazing. Well if any of you guys have any tips or suggestions on any of this I would appreciate it. Hi Alex, Check Mark Summerfield's book on PyQt4 : http://www.qtrac.eu/pyqtbook.html Other links : http://www.rkblog.rk.edu.pl/w/p/python/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Genetic programming: pygene, pygp, AST, or (gasp) Lisp?
David Boddie a écrit : On Sunday 20 July 2008 09:52, John Ladasky wrote: Is there a way to interface Lisp to Python, so that I can do all the interface programming in the language I already know best -- and just do the genetic parts in Lisp? I haven't seen exception handling in Lisp, a feature I've come to love in Python. Since it is fairly easy for a randomly-generated program to generate illegal output (I already know this from my initial experiments in Python), I don't think I can live without exception handling. Just searching the Web for Python and Lisp yielded some interesting projects: http://www.biostat.wisc.edu/~annis/creations/PyLisp/ http://www.livelogix.net/logix/ I've no idea if they're really that relevant to your problem, but they might lead somewhere useful. David CLPython seems also a good alternative : http://common-lisp.net/project/clpython/ -- http://mail.python.org/mailman/listinfo/python-list
Re: text processing
You can do it with regexps too : >-- import re to_watch = re.compile(r"(?P\d+)[/](?P[A-Z]+)") final_list = to_watch.findall("12560/ABC,12567/BC,123,567,890/JK") for number,word in final_list : print "number:%s -- word: %s"%(number,word) >-- the output is : number:12560 -- word: ABC number:12567 -- word: BC number:890 -- word: JK See you, Kib². -- http://mail.python.org/mailman/listinfo/python-list
tkinter textwidget problem
Hi, In a tkinter TextWidget I would like to retrieve the last typed word. I've tried this with the 'wordstart' Expression [From the effbot site, "wordstart" and "wordend" moves the index to the beginning (end) of the current word. Words are sequences of letters, digits, and underline, or single non-space characters.], but it fails : #!/usr/bin/env python # -*- coding: utf-8 -*- from Tkinter import * root = Tk() text = Text(root, font=("Calibri")) text.pack() # Insert some text inside (13 chars long) text.insert(INSERT, "one two three") # idx_st : the position of the cursor # idx_ed : same but translated to the beginning of the last word ? idx_st = text.index( "insert" ) # returns 1.13 idx_ed = text.index( "insert wordstart" ) # returns 1.13 too : why ? print idx_st,idx_ed print "Text=",text.get(idx_st,idx_ed) mainloop() Any idea ? Thanks in advance : Kib². -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter textwidget problem
Tk/Tkinter apparently considers the position 1.13 to be after the last word in the text. You get the same problem if you set the insertion point just after the word 'two' for example: text.index('insert') returns 1.7 and text.index('insert wordstart') returns 1.7 too... Exactly. My solution would simply be to go back one character before asking the word start: text.index('insert - 1 chars wordstart') Don't know if that'll do what you want if there are spaces at the end of the text. And BTW, if you actually want the *last* word in the text, you may want to use text.index('end - 2 chars wordstart'). Here, you have to use '- 2 chars' because end points to the first non-existent index (2.0 in your case...). HTH Good idea, it seems to work fine now. See you. Kib². -- http://mail.python.org/mailman/listinfo/python-list