Archive for March, 2008

Starting with twill, nosetests and easy_install

Wednesday, March 26th, 2008

Many people have asked for help on installing the excellent nosetests tool so I decided to record a few short screencasts on installing easy_install, installing nosetests and installing twill.

To show twill in action I have started work on a subscriber-only series which teaches the viewer how to test a website using twill and nosetests. The source is public (it is listed below each video) so non-subscribers can follow-along too.

The series covers:

  • Checking that major pages exist and generate a 200 OK
  • Finding and following links
  • Confirming a page’s title and body html
  • Manipulating a form to login and test the login-process

I also use nosetests in several ways along with test functions and a test class. This should be all a Python programmer needs to get started with automated website testing.

This is one of our ShowMeDo Club tutorials for subscribers, a part of our 231 (mostly free!) screencasts that help you to learn Python. Subscribers get access to 6+ hours of Python tutorials, exercises and walk-throughs with new episodes every week.

Exercise and Solution 2 - Adding the About box and using HTML in wxPython

Monday, March 17th, 2008

The second exercise (with solution) in the wxPython Image Viewer tutorial gets you to use the HtmlWindow in a custom Dialog to add an About box to the Help menu.

In Exercise - Add an HTML About Dialog to the Help Menu I show you the basic code for an inherited wx Dialog along with the necessary steps to add an About menu item. I give you the necessary hints and then you’re all set to read some of the linked help pages to figure out how to solve the exercise.

In Worked solution - HTML About Dialog I walk you through the complete solution and show how we build up to having a working, HTML-based About box.

Previously we’ve covered memory-leaks, Images and StaticBitmaps, StatusBars and FileDialogs in this wxPython tutorial. This series has everything a new wxPython programmer needs to learn the basics of writing their own wx application. The final two episodes (on adding a Splash screen) will be published this coming week.

This is one of our subscriber-only tutorials, these build upon our free wxPython tutorials which live with our 188 Python tutorials. The source code for this episode is freely available (they all are) further down the video’s page.

Club Members get access to 6+ hours of Python tutorials, exercises and walk-throughs with new episodes every week. You can test your knowledge of Python and keep your skills up-to-date through our Club.

ShowMeDo March Update - Python Subscriptions going great, VoIP conference tonight

Thursday, March 13th, 2008

[This is a re-print of the monthly Update Email that is sent to all of our Members]

wxPython Videos Hit the Spot:

I’m really rather pleased to say that our Subscriber series on building a wxPython Image Viewer has been going down a storm and we’ve received a heap of great feedback.

The series will have 14 episodes and will be completed in the next 2 weeks. The current episodes (9 and 10) are an exercise with worked-solution to add a ‘mirror image’ menu command, the next 4 episodes will also be exercises with worked solutions (for adding a Splash Screen and adding an HTML About box).

The next 2 subscriber series are in preparation:

  1. Using twill to automatically test websites from within Python - as used to unittest showmedo.com
  2. Using pyWin32 to control Excel and other COM applications on Windows

To keep your skills up to date learn more about our Subscription package.

Subscribers get over 4 hours of Python tutorial videos including basic coding, IDEs, unit-testing, refactoring and debugging knowledge. Right now we cover core Python and wxPython, later we’ll expand to include other important modules and projects.

As mentioned last time anyone who joined us before February 10th receives a 50% discount. Full details and a publishing schedule are available.

Monthly Online Conference - Thursday evening (7pm UTC):

Every month we have an online voice conference to discuss what’s happening with our Authors and what features the site needs. Previously we’ve used Skype but now this month we’re using the free Gizmo VoIP/SIP software (Skype kept crashing!).

Our next conference is being held this evening at 7pm UTC (8PM CET). We normally have around 7 members in the conference and we’d love to open it up to some of our regular users. If you’d like to participate (or just lurk) then you’ll find initial details here in the Authors group.

We’d especially like some of our Subscribers to attend to give us feedback on the Subscription system. After the conference a recording (mp3 or ogg) will be made available - keep an eye on the Authors group.

Python Portal Updated and Subscriber-Videos Feed:

Our main Python portal has had an update so now you can keep track of which videos are available to Subscribers.

I’ve also added an RSS feed so you can track the release of each new subscriber-only video, this feed is linked on the /videos/python page.

New Google Group - ShowMeDo Learners:

For those of you who are currently learning a new topic I have added a new ShowMeDo Learners google group.

I noticed that many of you ask questions on the Comments forms and then the author (frequently me) acts almost as a bottleneck to the answers you might need. Now you can ask your questions in the Learners group - our authors and main users will be monitoring it.

The rule of the group is - put something in, take something out. Do please help out when someone asks a question. By helping to answer other people’s questions you’ll be stretching your own knowledge which naturally helps you to learn and keep your knowledge up to date.

Python Papers Article:

Our first magazine article is in preparation - yay! With luck by the next update mail we’ll have our long article published in next edition of The Python Papers.

For previous articles including Horst Jens’ article on ‘Python for Kids’ and ShowMeDo see Volume 2 Issue 2.

Adding your own tutorials:

You can learn how easy it is to share your own knowledge by visiting here and you can see screencasting examples for Linux, Mac and Windows here.

By adding your own videos to ShowMeDo you’ll be giving something back to the open-source movement and sharing your own hard-won knowledge with those who are eager to learn (and who like to say Thank-You!).

New videos:

All of our videos are shown here (takes a while to load).

You can keep track of new videos as they’re published using this RSS feed.

OpenStreetMap, steve - 2 very informative videos on collaborative local and world-wide mapping (the videos look great!).

python: create art with xturtle and random - 1 neat ‘kids video’ featuring Felix as he shows you how to use xturtle to draw nice random graphics.

Setting up Python 2.5 support in VIM, Jack Atkinson - 2 videos on compiling MinGW and adding Python support to VIM.

Screencasting in Linux, rfquerin-heathenx - 2 videos on GTK-RecordMyDesktop and encoding videos using MEncoder.

Solution 1 - Walk-through of adding the Mirror Image wxPython function

Monday, March 10th, 2008

In a follow-up to the last blog post (Exercise 1) I now walk through the solution. In this episode we add a menu item to our wxPython GUI which mirrors the image on the x-axis.

In the next 4 episodes we add an HTML-based About box and the week after we’ll finish with a Splash screen. These will be the 2nd and 3rd exercises for this series.

Previously we’ve covered memory-leaks, Images and StaticBitmaps, StatusBars and FileDialogs in this wxPython tutorial. This series has everything a new wxPython programmer needs to learn the basics of writing their own wx application.

This series is a part of Club ShowMeDo for subscribers, a part of our 231 (mostly free!) screencasts that help you to learn Python. Subscribers get access to 6+ hours of Python tutorials, exercises and walk-throughs with new episodes every week.

Exercise 1 for the wxPython Image Viewer - adding a Mirror function

Friday, March 7th, 2008

So far I’ve shown you how to build a wxPython-based Image Viewer through almost an hour of video. You’ll get a lot more from the series of course if you’re forced to work through some exercises - so here’s the first. In this episode I talk you through adding a Mirror function that will flip the image on the x-axis.

The next episode in the series will show you a fully-worked solution. Next week I’ll test you with adding an HTML-based About box and the week after we’ll finish with a Splash screen.

Previously we’ve covered memory-leaks, Images and StaticBitmaps, StatusBars and FileDialogs in this wxPython tutorial. This series has everything a new wxPython programmer needs to learn the basics of writing their own wx application.

This is one of our subscriber-only tutorials, these build upon our free wxPython tutorials which live with our 184 Python tutorials. The source code for this episode is freely available (they all are) further down the video’s page.

Subscribers get access to 6+ hours of Python tutorials, exercises and walk-throughs with new episodes every week. You can test your knowledge of Python and keep your skills up-to-date through our subscriptions.

Building a wxPython Image Viewer - 8th episode

Saturday, March 1st, 2008

For the 8th episode in the series we look at Avoiding wx Memory Leaks with .Destroy() to teach some good programming practice.

In the previous episode we created a memory leak by adding new StaticBitmaps to a Panel without removing the previous StaticBitmap. The Panel keeps track of a growing list of StaticBitmaps which we don’t need - these constitute a ‘leak’ (though they don’t actually cause us any problems). Obviously it is always good programming practice to avoid memory leaks.

We ask the Panel to GetChildren (inherited from Window.GetChildren) and show how many children are being tracked. We then use .Destroy() (inherited from Window.Destory()) to safely clean-up the previous StaticBitmap.

This is one of our Club ShowMeDo Python tutorials, these build upon our free wxPython tutorials which live with our 179 Python tutorials. The source code for this episode is freely available (they all are) further down the video’s page.

Club members get access to 6+ hours of Python tutorials, exercises and walk-throughs with new episodes every week.

“Good job Ian! This video really repays playing over more than once. I like the way that you are building up the code by assembling the parts and explaining them as you go along. wxPython is a lot more complicated than regular Python, and can be confusing if the viewer tries to take in too much as once.” - Jerol Harrington (ShowMeDo Author)