Date: 15 Aug 2000 11:52:18 -0000 To: python-list@python.org Subject: [FAQTS] Python Knowledge Base Update -- August 15th, 2000 From: Fiona Czuczman <fiona@sitegnome.com> Newsgroups: comp.lang.python Hi All, The latest entries into http://python.faqts.com regards, Fiona Czuczman ## New Entries ################################################# ------------------------------------------------------------- How can I replace the contents of a listbox with a new list of items? http://www.faqts.com/knowledge-base/view.phtml/aid/5362 ------------------------------------------------------------- Fiona Czuczman Matthew Dixon Cowles All you have to do is delete the old items and add some new ones: self.lb.delete(0, END) # clear for item in myList: self.lb.insert(END, item) I swiped that code pretty well directly from Fredrik Lundh's excellent introduction to Tkinter, which is at: http://www.pythonware.com/library/tkinter/introduction/index.htm If you haven't had a look at it, you may want to. You might also want to have a look at Greg MacFarlaine's cool Pmw (Python megawidgets): http://www.dscpl.com.au/pmw/ His ScrolledListBox widget will save you a step here since it has a setlist() method. ------------------------------------------------------------- What is the name of the file that contains the color definitions for Tkinter (like 'rosy brown', etc.)? http://www.faqts.com/knowledge-base/view.phtml/aid/5363 ------------------------------------------------------------- Fiona Czuczman Richard Chamberlain, John Grayson I don't think you'll find them anyway in the code, I believe they are an internal tcl/tk thing, ( although I think the colour names are X related). In your tools folder you'll find a little application called pynche which allows you to select colours and it returns the nearest Tk colour by name. There is a file in there called namedcolors.txt which lists the colours. ------------------ You'll find the colors defined in tk8.0.n/xlib/X11/xcolors.c. You can also find a little Python program in the examples for my book which displays all the colors. You can find it in the utils subdirectory as colors.py You don't have to buy the book to get the examples... www.manning.com/Grayson ------------------------------------------------------------- Can python be embedded in a fortran program? http://www.faqts.com/knowledge-base/view.phtml/aid/5364 ------------------------------------------------------------- Fiona Czuczman Robert Kern, G. David Kuhlman Problem: There is some documentation (and also a lot of threads on this newsgroup) on embedding python in a c program. I would like to embed it in a fortran program so that the gui, input, error checking is done by python and core computations are done in fortran. does anybody have any idea on doing this? where can i find pointers for the same? I have access to Compaq visual fortran 6.1. Solutions: In this case, you might want to extend the interpreter with extension modules written in C that call the FORTRAN routines, rather than embed the interpreter into your program. It depends on how well you can separate the computation routines from the rest of the program that has already been written. To assist you, there are the following tools: Numerical Python: http://numpy.sourceforge.net Pyfort: http://pyfortran.sourceforge.net f2py: http://koer.ioc.ee/projects/f2py2e/ The last two depend on Numerical Python. ---------------- On any platform in which C code can be linked in with and called from FORTRAN, this problem is equivalent to embedding Python in a C application. Embed Python into a C module, produce a shared library, and call into that (C) module from FORTRAN.