<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Toes to the Edge &#187; Python</title>
	<atom:link href="http://powertwenty.com/kpd/blog/index.php/category/python/feed" rel="self" type="application/rss+xml" />
	<link>http://powertwenty.com/kpd/blog</link>
	<description>Rowing, Python, and experiences of a Micro-ISV</description>
	<lastBuildDate>Wed, 14 Jul 2010 01:57:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Forcing a HTTP Proxy on Local Google App Engine Development Server</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/forcing_a_http_proxy_on_local_google_app_engine_development_server_</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/forcing_a_http_proxy_on_local_google_app_engine_development_server_#comments</comments>
		<pubDate>Tue, 26 Jan 2010 22:20:25 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/?p=144</guid>
		<description><![CDATA[<br/>I&#8217;ve been trying somewhat in vain to debug a REST interface that&#8217;s failing when running under GAE.  After some searching, I found a way to force the local development server to use an http proxy (such as Charles or Membrane).
Make the following changes in the file:
C:\Program Files\Google\google_appengine\google\appengine\api\urlfetch_stub.py
around line 193:
&#160;&#160;&#160;&#160;&#160;&#160;
&#60;pre&#62;
try:
&#160;&#160;&#160;&#160;if protocol == &#039;http&#039;:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;logging.debug(&#34;using proxy [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I&#8217;ve been trying somewhat in vain to debug a REST interface that&#8217;s failing when running under GAE.  After some searching, I found a way to force the local development server to use an http proxy (such as <a href="http://www.charlesproxy.com/">Charles</a> or <a href="http://predic8.com/open-source/soap-monitor/">Membrane</a>).</p>
<p>Make the following changes in the file:</p>
<p>C:\Program Files\Google\google_appengine\google\appengine\api\urlfetch_stub.py</p>
<p>around line 193:</p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;pre&gt;
try:
&nbsp;&nbsp;&nbsp;&nbsp;if protocol == &#039;http&#039;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logging.debug(&quot;using proxy instead of %s path=%s&quot;, host, path)&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection = httplib.HTTPConnection(&quot;127.0.0.1&quot;, 8888)&nbsp;&nbsp; # host and port of proxy server
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path = &quot;http://%s%s&quot;%(host,path)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logging.debug(&quot;new path is: &#039;%s&#039;&quot;, path)
&nbsp;&nbsp;&nbsp;&nbsp;elif protocol == &#039;https&#039;:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection = httplib.HTTPSConnection(host)
&nbsp;&nbsp;&nbsp;&nbsp;else:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error_msg = &#039;Redirect specified invalid protocol: &quot;%s&quot;&#039; % protocol
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logging.error(error_msg)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise apiproxy_errors.ApplicationError( urlfetch_service_pb.URLFetchServiceError.FETCH_ERROR, error_msg) 
&lt;/pre&gt;
</code></pre></p>
<p>You may wish to make the same change for Https as well.  It would not be too hard to fix it the right way by having it check for the http_proxy environment variable, but I haven&#8217;t done that.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/forcing_a_http_proxy_on_local_google_app_engine_development_server_/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Restful Interfaces to 3rd-Party Websites in Python</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/restful_interfaces_to_3rd-party_websites_in_python</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/restful_interfaces_to_3rd-party_websites_in_python#comments</comments>
		<pubDate>Tue, 19 Jan 2010 01:57:05 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/?p=141</guid>
		<description><![CDATA[<br/>Here are the slides and examples from my Code Mash 2.0.1.0 talk:
Restful Interfaces to 3rd-Party Websites with Python (PDF)
examples.tar.gz
]]></description>
			<content:encoded><![CDATA[<br/><p>Here are the slides and examples from my <a href="http://www.codemash.org/">Code Mash 2.0.1.0</a> talk:</p>
<p><a href="http://powertwenty.com/kpd/downloads/Restful_Interfaces_to_Third-Party_Websites_with_Python.pdf">Restful Interfaces to 3rd-Party Websites with Python (PDF)</a></p>
<p><a href="http://powertwenty.com/kpd/downloads/Restful_Interfaces_to_Third-Party_Websites_with_Python_examples.tar.gz">examples.tar.gz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/restful_interfaces_to_3rd-party_websites_in_python/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wxPython Font by Pixel Height</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/wxpython_font_by_pixel_height</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/wxpython_font_by_pixel_height#comments</comments>
		<pubDate>Wed, 11 Nov 2009 11:42:44 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[wxPython]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/?p=98</guid>
		<description><![CDATA[<br/>I&#8217;ve been looking to find a way to resize a font when the window&#8217;s size changes.  Here is code that will create a font that is close as possible to a given height in pixels without specifying anything about the font width.   Osku Salerma posted some code in GitHub that did the [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I&#8217;ve been looking to find a way to resize a font when the window&#8217;s size changes.  Here is code that will create a font that is close as possible to a given height in pixels without specifying anything about the font width.   <a href="http://github.com/oskusalerma">Osku Salerma</a> posted <a href="http://github.com/oskusalerma/blyte/blob/master/util.py">some code in GitHub</a> that did the trick.   </p>
<p>I changed it a bit to make it self-contained.   Here&#8217;s my modified version of his code to create a wxPython font given a height in pixels:</p>
<p><pre><code>
&lt;pre&gt;
&nbsp;&nbsp;&nbsp;&nbsp;def createFontFromHeightInPixels(self, heightInPixels, family, style, weight):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# return a font that&#039;s as close to &#039;heightInPixels&#039; as possible without being larger
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# modified from code at http://github.com/oskusalerma/blyte/blob/master/util.py&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fontSizeToTest = 6
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bestFontSoFar = wx.Font(fontSizeToTest, family, style, weight, encoding = wx.FONTENCODING_ISO8859_1)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closestDiffInPixelsSoFar = 1000
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;testDc = wx.MemoryDC()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;testDc.SelectObject(wx.EmptyBitmap(512, 32)) 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while 1:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;testedFont = wx.Font(fontSizeToTest, family, style, weight, encoding = wx.FONTENCODING_ISO8859_1)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;testDc.SetFont(testedFont)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;heightOfTestedFont = testDc.GetTextExtent(&quot;_\xC5&quot;)[1]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;diff = heightInPixels-heightOfTestedFont
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if diff &gt;= 0:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if diff &lt; closestDiffInPixelsSoFar:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closestDiffInPixelsSoFar = diff
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bestFontSoFar = testedFont
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fontSizeToTest += 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return bestFontSoFar 
&lt;/pre&gt;
</code></pre></p>
<p>It would be used like this assuming the above function is in the window class or one of its superclasses:</p>
<p><pre><code>
&lt;pre&gt;
def __init__(self, *args, **kwds):
&nbsp;&nbsp;&nbsp;&nbsp;.
&nbsp;&nbsp;&nbsp;&nbsp;.
&nbsp;&nbsp;&nbsp;&nbsp;.
&nbsp;&nbsp;&nbsp;&nbsp;self.Bind(wx.EVT_SIZE, self.OnSize)&nbsp;&nbsp;&nbsp;&nbsp; 

def OnSize(self, event):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size = event.GetSize()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentFont = self.GetFont()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newFont = self.createFontFromHeightInPixels( (size.height*0.8), 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentFont.GetFamily(), currentFont.GetStyle(), currentFont.GetWeight())
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.label_1.SetFont(newFont)
 &lt;/pre&gt;
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/wxpython_font_by_pixel_height/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Mechanize with the Google App Engine</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/using_mechanize_with_the_google_app_engine</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/using_mechanize_with_the_google_app_engine#comments</comments>
		<pubDate>Sat, 26 Sep 2009 11:44:45 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/?p=93</guid>
		<description><![CDATA[<br/>code to make mechanize work under GAE]]></description>
			<content:encoded><![CDATA[<br/><p>A very slight tweak to the <a href="https://sourceforge.net/mailarchive/message.php?msg_name=alpine.DEB.2.00.0906071637060.14080%40alice">code posted by John Lee</a> on the wwwsearch mailing list at SourceForge allows <a href="http://wwwsearch.sourceforge.net/mechanize/">mechanize</a> to work on the google app engine.   The code I am using, which is almost all his, is:</p>
<p><pre><code>
&lt;pre&gt;
import urllib2
import copy
import mechanize
import mechanize._response

class GAEMechanizeHTTPHandler(mechanize.BaseHandler):

&nbsp;&nbsp;&nbsp;&nbsp;def __init__(self, gae_http_handler, debuglevel=0):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self._debuglevel = debuglevel
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self._gae_http_handler = gae_http_handler

&nbsp;&nbsp;&nbsp;&nbsp;def http_open(self, req):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return self._gae_http_handler.http_open(req)

def make_gae_handler():
&nbsp;&nbsp;&nbsp;&nbsp;return urllib2.HTTPHandler()

def make_http_handler():
&nbsp;&nbsp;&nbsp;&nbsp;gae_handler = make_gae_handler()
&nbsp;&nbsp;&nbsp;&nbsp;return GAEMechanizeHTTPHandler(gae_handler)

class GAEBrowser(mechanize.Browser):
&nbsp;&nbsp;&nbsp;&nbsp;handler_classes = copy.copy(mechanize.Browser.handler_classes)
&nbsp;&nbsp;&nbsp;&nbsp;handler_classes[&quot;http&quot;] = make_http_handler 
&lt;/pre&gt;
</code></pre></p>
<p>Mechanize is not thoroughly tested, but the above does allow my project&#8217;s code to pass its regression tests when running on the GAE.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/using_mechanize_with_the_google_app_engine/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Update to TimeSpin Control for wxGlade</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/update_to_timespin_control_for_wxglade</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/update_to_timespin_control_for_wxglade#comments</comments>
		<pubDate>Sat, 08 Mar 2008 20:17:52 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[wxPython]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/index.php/python/wxpython/update_to_timespin_control_for_wxglade</guid>
		<description><![CDATA[<br/>TimeSpin has a bug in that it reports the same width for GetBestSize  when AM/PM is shown and when it is not (24 hour format).  This causes an empty space to appear after the control when it is set to display time in 24 hours.  I&#8217;m not able to fix the bug [...]]]></description>
			<content:encoded><![CDATA[<br/><p>TimeSpin has a bug in that it reports the same width for <em>GetBestSize </em> when AM/PM is shown and when it is not (24 hour format).  This causes an empty space to appear after the control when it is set to display time in 24 hours.  I&#8217;m not able to fix the bug at this point, but I was able to add a workaround that adjusts the width as needed.</p>
<p><a href="http://powertwenty.com/kpd/downloads/time_spin_and_control_1.4.tar.gz">Version 1.4 of the time_spin_and_control distrubution</a> contains the workaround.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/update_to_timespin_control_for_wxglade/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update to TimeCtrl/TimeSpin wxGlade extension</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/update_to_timectrl2ftimespin_wxglade_extension_</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/update_to_timectrl2ftimespin_wxglade_extension_#comments</comments>
		<pubDate>Wed, 13 Feb 2008 12:21:29 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[wxPython]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/index.php/python/update_to_timectrl2ftimespin_wxglade_extension_</guid>
		<description><![CDATA[<br/>I added a workaround for a problem with timectrl.  
You&#8217;ll want to upgrade to the 1.4 version of the time_spin_and_control distribution if you use limited, min, max, or value parameters in Glade when specifying the control.
Edit &#8211; 3/8 &#8211; updated to version 1.4
]]></description>
			<content:encoded><![CDATA[<br/><p>I added a workaround for a <a href="http://sourceforge.net/tracker/index.php?func=detail&#038;aid=1892666&#038;group_id=9863&#038;atid=109863">problem</a> with timectrl.  </p>
<p>You&#8217;ll want to upgrade to the <a href="http://powertwenty.com/kpd/downloads/time_spin_and_control_1.4.tar.gz">1.4 version of the time_spin_and_control distribution</a> if you use limited, min, max, or value parameters in Glade when specifying the control.</p>
<p>Edit &#8211; 3/8 &#8211; updated to version 1.4</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/update_to_timectrl2ftimespin_wxglade_extension_/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding a TimeCtrl Widget to wxGlade</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/adding_a_timectrl_widget_to_wxglade</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/adding_a_timectrl_widget_to_wxglade#comments</comments>
		<pubDate>Mon, 11 Feb 2008 12:17:46 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[wxPython]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/index.php/python/adding_a_timectrl_widget_to_wxglade</guid>
		<description><![CDATA[<br/>The program I&#8217;m working on (ErgMate) requires entry of hours/mins/seconds durations.  I just defined input as total number of seconds for the initial prototypes, but the time has come to make it more usable.   I was able to create the bridge code necessary to add the wx.lib.masked.TimeCtrl to the wxGlade widget palette [...]]]></description>
			<content:encoded><![CDATA[<br/><p>The program I&#8217;m working on (<a href="http://www.powertwenty.com/ergmate/index.html">ErgMate</a>) requires entry of hours/mins/seconds durations.  I just defined input as total number of seconds for the initial prototypes, but the time has come to make it more usable.   I was able to create the bridge code necessary to add the wx.lib.masked.TimeCtrl to the wxGlade widget palette by following examples from Alberto Griggio .   </p>
<p>The normal TimeCtrl can bind to an external scroll button.   The package also includes a new control called TimeSpin.  It is based on Andrea Gavana&#8217;s FloatSpin control, and provides both a TimeCtrl and scroll button in one control.  TimeSpin does not accept the <em>format </em>nor the <em>scrollBar </em>parameters, otherwise it should be a drop-in replacement for TimeCtrl.  Let me know if I missed something important in the interface.</p>
<p><a href="http://powertwenty.com/kpd/blog/wp-content/uploads/TimeSpinInGlade.png"><img src="http://powertwenty.com/kpd/blog/wp-content/uploads/_TimeSpinInGlade.png" width="231" height="250" alt="" title=""  /></a></p>
<p>There is (at least!) one minor problem with TimeSpin: It seems to report too large a width &#8211; its bounding box is actually wider than the displayed control.   I&#8217;d appreciate anyone with more knowledge of wxPython than I looking into it and sending a patch.  For now it&#8217;s good enough to get started using.</p>
<p>Both time widgets are added to wxGlade by untarring the <a href="http://powertwenty.com/kpd/downloads/time_spin_and_control_1.4.tar.gz">time_spin_and_control distribution</a> from within your .wxglade directory. The included README contains more details.</p>
<p>Edit:<br />
1.1 &#8211; fixed codegen problem w/value<br />
1.2 &#8211; fixed loading problem when presetting a value<br />
1.3 &#8211; added workaround for bug in timectrl when using min/max/limited settings</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/adding_a_timectrl_widget_to_wxglade/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CLEPY &#8211; SimpleParse, IPython, and Twill</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/clepy_-_simpleparse2c_ipython2c_and_twill</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/clepy_-_simpleparse2c_ipython2c_and_twill#comments</comments>
		<pubDate>Tue, 05 Feb 2008 10:43:35 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/index.php/python/clepy_-_simpleparse2c_ipython2c_and_twill</guid>
		<description><![CDATA[<br/>The February Cleveland Area Python Users Group Meeting was held last night.  The guys at BitBacker opened their doors and supplied pizza.   It was the best meeting in awhile &#8211; 3 talks!  
Christian Wyglendowski kicked things off with an overview of SimpleParse.  He&#8217;s used it in applications from an ini [...]]]></description>
			<content:encoded><![CDATA[<br/><p>The February Cleveland Area Python Users Group Meeting was held last night.  The guys at <a href="https://www.bitbacker.com/">BitBacker</a> opened their doors and supplied pizza.   It was the best meeting in awhile &#8211; 3 talks!  </p>
<p><a href="http://blog.dowski.com/">Christian Wyglendowski</a> kicked things off with an <a href="http://dowski.com/~christian/clepy/parsing/presentation/">overview of SimpleParse</a>.  He&#8217;s used it in applications from an ini file parser to a parser for an online survey processing language.  It looks easy to use. Some time ago I wrote a <a href="http://pyfltk.sourceforge.net/">parser for generating Python code from FLTK&#8217;s Fluid GUI builder data files</a> using Spark.  A great library, but SimpleParse might have been so much easier &#8211; it depends if I could have created or found a grammar for the fluid file format.</p>
<p>Matt Wilson spoke on IPython.  I&#8217;ve been using IPython for some time and realized I wasn&#8217;t making full use of it.  Until his talk I didn&#8217;t realize how much of IPython I was missing (&#8220;You only use 10% of your Ipython&#8217;s capabilities&#8230;.&#8221;).  Never knew it would assign results to _## where ## is the history line number.  That alone will save a lot of time.  Matt&#8217;s Ipython talk notes are <a href="http://scratch.tplus1.com/clepy/ipython.txt">online at his website</a>.</p>
<p>Matt also gave a short talk on <a href="http://twill.idyll.org/">Twill</a>.  Twill is a domain-specific language used to test websites and web applications.  The most interesting part of Twill is its extensibility.  He demonstrated how one can add automatic checks as Twill encounters each page in your application &#8211; checks for tables-within-tables for example.   <a href="http://scratch.tplus1.com/clepy/twill.txt">Matt&#8217;s notes contain more information.</a></p>
<p>These talks gave us a lot to take home and think about. </p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/clepy_-_simpleparse2c_ipython2c_and_twill/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception when Generating Code from wxGlade &#8211; and how to fix it</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/wxpython/exception_when_generating_code_from_wxglade_-_and_how_to_fix_it</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/wxpython/exception_when_generating_code_from_wxglade_-_and_how_to_fix_it#comments</comments>
		<pubDate>Sat, 02 Feb 2008 13:18:19 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[wxPython]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/index.php/python/wxpython/exception_when_generating_code_from_wxglade_-_and_how_to_fix_it</guid>
		<description><![CDATA[<br/>This morning I started getting the following exception when generating code from wxGlade:

&#60;pre&#62;
Traceback (most recent call last):
&#160;&#160;File &#34;c:\temp\wxGlade\application.py&#34;, line 394, in generate_code
&#160;&#160;&#160;&#160;class_names=class_names)
&#160;&#160;File &#34;c:\temp\wxGlade\xml_parse.py&#34;, line 503, in __init__
&#160;&#160; .
&#160;&#160; .
&#160;&#160; .
&#160;&#160;File &#34;c:\temp\wxGlade\xml_parse.py&#34;, line 593, in endElement
&#160;&#160;&#160;&#160;self.code_writer.add_class(obj)
&#160;&#160;File &#34;c:\temp\wxGlade\codegen\py_codegen.py&#34;, line 640, in add_class
&#160;&#160;&#160;&#160;indentation = prev_src.spaces[code_obj.klass]
KeyError: &#039;FancyListControl&#039;
&#60;/pre&#62;

There was only one mention of a similar problem on the wxGlade mailing [...]]]></description>
			<content:encoded><![CDATA[<br/><p>This morning I started getting the following exception when generating code from wxGlade:</p>
<p><pre><code>
&lt;pre&gt;
Traceback (most recent call last):
&nbsp;&nbsp;File &quot;c:\temp\wxGlade\application.py&quot;, line 394, in generate_code
&nbsp;&nbsp;&nbsp;&nbsp;class_names=class_names)
&nbsp;&nbsp;File &quot;c:\temp\wxGlade\xml_parse.py&quot;, line 503, in __init__
&nbsp;&nbsp; .
&nbsp;&nbsp; .
&nbsp;&nbsp; .
&nbsp;&nbsp;File &quot;c:\temp\wxGlade\xml_parse.py&quot;, line 593, in endElement
&nbsp;&nbsp;&nbsp;&nbsp;self.code_writer.add_class(obj)
&nbsp;&nbsp;File &quot;c:\temp\wxGlade\codegen\py_codegen.py&quot;, line 640, in add_class
&nbsp;&nbsp;&nbsp;&nbsp;indentation = prev_src.spaces[code_obj.klass]
KeyError: &#039;FancyListControl&#039;
&lt;/pre&gt;
</code></pre></p>
<p>There was only one mention of a <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=ccee3d7d0709061349j2dd1870el2744bcd51bee6f57%40mail.gmail.com&#038;forum_name=wxglade-general">similar problem</a> on the wxGlade mailing list.  The solution posted there was to start a new project &#8211; not really an option at this stage of development.</p>
<p>So after a little digging, I found a different solution.</p>
<p>The item causing the problem is a fancy subclass of ListControl defined in another module.  I had placed a wx.Panel in the sizer slot, and had then changed the class to my fancy ListControl.   Is the problem now obvious?  This fancy list control is not equivalent to a wx.Panel from wxGlade&#8217;s perspective.  Removing the panel and instead adding a ListControl with my fancy control as the class name fixed everything up. </p>
<p>So, in summary, use the closest matching wxGlade class (ListControl instead of Panel) when using your own classes.  </p>
<p>Doh.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/wxpython/exception_when_generating_code_from_wxglade_-_and_how_to_fix_it/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watch out for wxGlade&#8217;s Overwrite Sources!</title>
		<link>http://powertwenty.com/kpd/blog/index.php/python/wxpython/watch_out_for_wxglade5c27s_overwrite_sources21</link>
		<comments>http://powertwenty.com/kpd/blog/index.php/python/wxpython/watch_out_for_wxglade5c27s_overwrite_sources21#comments</comments>
		<pubDate>Thu, 15 Feb 2007 13:02:23 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[wxPython]]></category>

		<guid isPermaLink="false">http://powertwenty.com/kpd/blog/index.php/python/wxpython/watch_out_for_wxglade5c27s_overwrite_sources21</guid>
		<description><![CDATA[<br/>wxGlade has an option for &#8216;overwrite sources&#8217; in the application dialog:

I normally have it off, but when doing some exploratory testing I enabled it.    This morning I was working on my main application and regenerated the code.  Guess what?  Yes, it overwrote every gui class.   Three things led [...]]]></description>
			<content:encoded><![CDATA[<br/><p>wxGlade has an option for &#8216;overwrite sources&#8217; in the application dialog:</p>
<p><img src="http://powertwenty.com/kpd/blog/wp-content/uploads/overwriteexistingsources.jpg" width="250" height="54" alt="" title="" /></p>
<p>I normally have it off, but when doing some exploratory testing I enabled it.    This morning I was working on my main application and regenerated the code.  Guess what?  Yes, it overwrote every gui class.   Three things led to this:</p>
<p>1. I had assumed the overwrite setting was stored in the .wxg file (it is part of the configuration for a given application.)<br />
2. My main wxsGlade window is sized so that option is not normally visible.<br />
3. The value for &#8216;overwrite sources&#8217; is actually a global configuration.</p>
<p>So BE CAREFUL with this option.   Fortunately, a <em>svn update</em> brought the code back to where it was just a few minutes earlier minus a minor gui change.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/kpd/blog/index.php/python/wxpython/watch_out_for_wxglade5c27s_overwrite_sources21/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
