Using Chandler as an IDE
February 24th, 2006 1 Comment »
I’ve been working on what I’ve been calling MultiBitmapButton for a while now.
At first I was using the
ports version
of wxPython to test a small script that had my class in it.
It seemed like a good way to do it, since trying to edit a class in the Chandler code and then waiting for Chandler to start up to test it was slow at best.
This worked quite well at first.
I was getting this warning, but it didn’t seem to affect anything:

Komodo debugging my script
(click for larger version)
It told me that the error was:

PyShell is fully interactive, and gives you a lot of help as you type your code.
Code completion, argument templates - the works.
Along with this you have the native Python help facility, which you get to by just entering “help()” and hitting return:
:-D
/opt/local/lib/python2.4/site-packages/wx-2.6-mac-unicode/wx/_core.py:13155: UserWarning: wxPython/wxWidgets release number mismatch
warnings.warn(”wxPython/wxWidgets release number mismatch“)
This meant I was running wxPython version 2.6.1, but was using wxWidgets (the C++ library that wxPython wraps) version 2.6.2.
I had a window showing up, and was using sizers with normal buttons just to verify that everything was okay.
But then I tried to add a MultiBitmapButton.
*Boom*, the script would fail after flashing a window with what looked like the error info I needed.
So I tried using
Komodo,
a Python IDE.
You can see what it looked like when it hit the error if you click on the image below.

Komodo debugging my script
(click for larger version)
Looking at object failed - exceptions.AttributeError: ‘Frame’ object has no attribute ‘this’Knowing what I do about C++ and how it uses “this”, I knew that this meant it was something wayyyy down deep, and was probably a result of the release mismatch between wxWidgets and wxPython. So, I tried to update my ports install of wxPython to v 2.6.1, but it doesn’t look like ports has updated yet. You know, I’ve been meaning to find out how to set up a port myself so I could contribute some they are missing. In this case, I could update wxPython myself. But I haven’t, so I didn’t, so oh well. Now, I had heard about this shell you could bring up in Chandler via the “Test” menu. Given what I knew about Python and modules etc., I figured that it should be possible to use that shell to at least paste in my code and get some kind of feedback. What the heck. Wow, did I ever hit the motherload. I started up Chandler and chose the menu item “Test→Show Python Shell”. I got a terminal-ish looking window with the usual “
>>> ” prompt.
So, I started to type in some simple code to create a wx Frame, as a proof of concept.
I noticed right away that this wasn’t just a terminal-ish window!

>>> help()
Welcome to Python 2.4! This is the online help utility.
If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://www.python.org/doc/tut/.
Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type “quit”.
To get a list of available modules, keywords, or topics, type “modules”, “keywords”, or “topics”. Each module also comes with a one-line summary of what it does; to list the modules whose summaries contain a given word such as “spam”, type “modules spam”.
help>
Wow.
Now, I’ve managed to osmose a few Python tricks from Jeremy and others.
Key is the “dir” command, which tells you a lot about an object, module, what have you.
But I didn’t realize until I read that help blurb that I could get a list of all modules from which to start.
Woah.
So.. I typed “modules” and stood back!
*Whew*! I think I’m really starting to like this.Please wait a moment while I gather a list of all available modules... Audio_mac _bsddb fpformat repository (package) BaseHTTPServer _builtinSuites (package) ftplib repr Bastion _codecs gc resource CGIHTTPServer _codecs_cn gensuitemodule rexec Canvas _codecs_hk gestalt rfc822 Carbon (package) _codecs_iso2022 getopt rgbimg Chandler _codecs_jp getpass rlcompleter CodeWarrior (package) _codecs_kr gettext robotparser ColorPicker _codecs_tw glob samples (package) ConfigParser _csv gopherlib sched Cookie _curses grp select Dialog _curses_panel gzip sets DocXMLRPCServer _heapq heapq sgmllib EasyDialogs _hotshot hmac sha Explorer (package) _locale hotshot (package) shelve FileDialog _multibytecodec htmlentitydefs shlex Finder (package) _random htmllib shutil FixTk _socket httplib signal FrameWork _sre i18n (package) site HTMLParser _ssl ic smtpd IN _strptime icglue smtplib M2Crypto (package) _symtable icopen sndhdr MacOS _testcapi idlelib (package) socket MimeWriter _threading_local ihooks sre MiniAEFrame _weakref imageop sre_compile Nav aepack imaplib sre_constants Netscape (package) aetools imghdr sre_parse OSATerminology aetypes imp stat PixMapWrapper aifc imputil statcache PyICU amazon (package) inspect statvfs PyICU_bases anydbm itertools string PyICU_calendar applesingle jabber stringold PyICU_collator appletrawmain keyword stringprep PyICU_dateformat appletrunner libxml2 strop PyICU_errors application (package) libxml2mod struct PyICU_format argvemulator linecache subprocess PyICU_iterators array locale sunau PyICU_locale asynchat logging (package) sunaudio PyICU_numberformat asyncore logilab (package) symbol PyLucene atexit macerrors symtable Queue audiodev macfs sys SOAPpy (package) audioop macostools syslog ScrolledText autoGIL macpath tabnanny SimpleDialog base64 macresource tarfile SimpleHTTPServer bdb macurl2path telnetlib SimpleXMLRPCServer bgenlocations mailbox tempfile SocketServer binascii mailcap terminalcommand StdSuites (package) binhex markupbase termios StringIO bisect marshal textwrap SystemEvents (package) bsddb (package) math this Terminal (package) bsddb185 md5 thread Tix buildtools mhlib threading Tkconstants bundlebuilder mimetools time Tkdnd bz2 mimetypes timeit Tkinter cPickle mimify timing UserDict cStringIO mmap tkColorChooser UserList calendar modulefinder tkCommonDialog UserString cfmfile multifile tkFileDialog WASTEconst cgi mutex tkFont _AE cgitb netrc tkMessageBox _AH chandlerdb (package) new tkSimpleDialog _App chunk nis toaiff _CF cmath nntplib token _CG cmd ntpath tokenize _CarbonEvt code nturl2path tools (package) _Cm codecs opcode trace _Ctl codeop operator traceback _Dlg collections optik (package) tty _Drag colorsys optparse turtle _Evt commands os twisted (package) _File compileall os2emxpath types _Fm compiler (package) osaf (package) tzparse _Folder cookielib parser unicodedata _Help copy pdb unittest _IBCarbon copy_reg photos (package) urllib _Icn crypt pickle urllib2 _LWPCookieJar csv pickletools urlparse _Launch curses (package) pimp user _List datetime pipes util (package) _Menu dateutil (package) pkgutil uu _Mlte dbhash platform version _MozillaCookieJar dbm plistlib videoreader _OSA decimal popen2 vobject (package) _PyICU difflib poplib warnings _PyICU_bases dircache posix wave _PyICU_calendar dis posixfile weakref _PyICU_collator distutils (package) posixpath webbrowser _PyICU_dateformat doctest pprint whichdb _PyICU_errors drv_libxml2 profile whrandom _PyICU_format dumbdbm pstats wx (package) _PyICU_iterators dummy_thread pty wxPython (package) _PyICU_locale dummy_threading pwd xdrlib _PyICU_numberformat email (package) py_compile xml (package) _PyLucene encodings (package) pychecker (package) xmllib _Qd epydoc (package) pyclbr xmlrpclib _Qdoffs errno pydoc xmlstream _Qt exceptions pyexpat xxsubtype _Res fcntl pylint (package) zanshin (package) _Scrap feeds (package) quopri zipfile _Snd filecmp random zipimport _TE fileinput re zlib _Win findertools reconvert zope (package) __builtin__ flickr (package) regex __future__ fnmatch regex_syntax _bisect formatter regsub Enter any module name to get more help. Or, type "modules spam" to search for modules whose descriptions contain the word "spam".
:-D



The
