Category Archives: Python

Is related to the Python Programming language in some way

wxPython: An Intro to the UltimateListCtrl

One of the new agw widgets to be included in wxPython is one called the UltimateListCtrl. It’s a pure Python widget that can have pretty much any other widget stuck into any of the cells, which makes it really flexible. It also allows the skilled programmer the ability to add custom renderers to make the interface different. In this article, we will take a quick look at this fascinating widget. Continue reading wxPython: An Intro to the UltimateListCtrl

wxPython: New Widget Announced: XLSGrid

Recently, Andrea Gavana, developer of the agw library in the wxPython code base, released his newest widget: XLSGrid. It’s purpose is to faithfully reproduce the appearance of a Microsoft Excel spreadsheet (one worksheet per every instance of XLSGrid). This widget is based on wx.grid.PyGridTableBase and wx.grid.PyGridCellRenderer and requires xlrd. Andrea also recommends using Mark Hammond’s PyWin32 module or the widget’s formatting abilities will be very limited. If you’d like to read the full announcement, just go here.

Continue reading wxPython: New Widget Announced: XLSGrid

wxPython: Windows Styles and Events Hunter

If you’re a long time reader of this blog, then you will know that I really like the wxPython GUI toolkit. Something that seems to stump new wxPython users is how to find out what styles and events each widget has though. It does take some practice to learn how the documentation works, but there’s a nice little program that Andrea Gavana put together that he calls the Windows Styles and Events Hunter. It was released a couple years ago on the mailing list, but I don’t think it was very popular. I use it for answering questions on the wxPython mailing list or on their IRC channel, so I know it’s pretty handy.

Here’s what it looks like in action:

Let’s take a look and try it out! Continue reading wxPython: Windows Styles and Events Hunter

Python Links for the Week: 7/22/2011

Another week is over and we have a new set of articles for you to check out this weekend. You can learn new things, try modules, and be productive. Or you can go party. Don’t forget about all the different PyCons going on this year around the world. There are local ones and International conferences.

That’s all for this week. Let me know if you find anything cool that you think I should highlight next time.

Python Links of the Week: 07/15/2011

I’ve been kind of lazy about putting these out lately, but I have decided to try to do this more regularly. This week covers a lot of different topics including a controversial article from Steve Holden! You can also learn about an exotic location for a Python Conference, Sage and Meta-programming. If you’re new to Python, then you will be amazed at the diversity of the topics. These don’t even begin to scratch the surface of what is going on in the Python world, but they may whet your appetite. Enjoy!

  • Ever wanted to learn a little about Meta-programming in Python? Now’s your chance!
  • Don’t know Sage? Well, there’s a Beginner’s Guide for it out now and here’s a review by John Cook.
  • Steve Holden talks about Childish Behavior regarding the naming of a certain Python module
  • PyCon Australia’s schedule has been announced! Now you too can learn about Python and see Kangaroos in their natural habitat. I call that a win/win!
  • There’s an update on the Python African tour
  • For up to the minute Python news, check out Twitter
  • NWSGI 2.1 for IronPython 2.7 out now

wxPython: Get the Event Name Instead of an Integer

There was a recent post on StackOverflow that I thought was interesting. It asked how to get the event name from the event object, such as EVT_BUTTON, rather than the event’s id number. So I did some investigation into the subject and there is nothing builtin to wxPython that does this task. Robin Dunn, creator of wxPython, recommended that I should create a dictionary of the events and their ids to accomplish this feat. So in this tutorial, we’ll take a look at how to go about that. Continue reading wxPython: Get the Event Name Instead of an Integer

wxPython: Learning to Use Fonts

Have you ever wondered about how to change your font in wxPython? Well, now is your lucky day because that is exactly what this tutorial is going to cover. We will look at the following three items:

  • Built-in fonts of wxPython
  • The font dialog
  • The font enumerator demo from the wxPython demo

Fonts are an important part of your program and enhance your program’s readability. It’s always a good idea to make sure your fonts are the right size and place. Yes, that’s common sense, but sometimes common sense doesn’t happen in programming. Enough philosophizing. Let’s get to the meat of the article!

Continue reading wxPython: Learning to Use Fonts

PyCon 2011: Post-PyCon Articles

PyCon 2011 (USA) is over. But a lot of people wrote articles about it. So in case you missed the action, you can check out a few of the articles about what happened. If you don’t see your favorite PyCon-related article here, let me know in the comments.

PyCon 2011: TiP BoF

The venerated TiP BoF (Testing in Python “Birds of a Feather”) meeting was held Saturday (3/12/2011) night around 7 p.m. Disney provided free pizza and salads. Someone else (I think) provided some pop. The room was packed with standing room only in the back. While people were eating, Terry Peppers of Leapfrog led the meeting. He told us how the TiP BoF worked and then had one of his employees show us how to do weird hand/arm stretches. If I remember correctly, his name was Feihung Hsu.

After that, the testing-related lightning talks started. The lightning talks are really the main draw of this event, although in years past the alcohol induced many to come. This year, the hotel cracked down on that and there was hardly any liquor to be seen, which was alright by me. I only stayed for two hours, so I’ll just give a run-down of what I saw and heard:

  • There were lots of masturbation and other crude jokes even before we ate anything and they continued through most of the time I was there
  • Peppers started the talks off with one called Snakes on a domain which was about a nagios plugin called NagAconda
  • Next, Disney awarded Jesse Noller with a Disney beer stein that was themed after their animated movie, “Tangled”.
  • Alfredo Deza gave a talk a DSL-testing framework called Konira
  • Following that was a talk on Cram – a mercurial test suite for command line testing. I missed who gave that one. I think it’s this one: https://bitbucket.org/brodie/cram/src
  • Then there was a talk on Lab Coat. They had the speaker wear a lab coat too. I don’t remember who did this one (maybe the author?) or what this project even does…
  • Roman Lisagor gave a talk on Freshen, a clone of Ruby’s Cucumber project. It’s a plugin for nose and supposed to be similar to the lettuce project.
  • Kumar McMillan gave a talk entitled Fudging it with Mock Objects. Yes, it’s another mock library, but this one is based on some project called Mocha (and I think he said he used stuff from Michael Foord’s mock library as well). You can check it out here: http://farmdev.com/projects/fudge/
  • The next talk was Scientific Testing in Python. My notes are bad on this one, but I think it was related to the Bright project (correct me if I’m wrong). The speaker also mentioned something called goathub.com, but as far as I can tell, that doesn’t really exist.
  • Feihung Hsu made another appearance by giving a talk himself. It has this long title: How My comic Book obsession birthed a new functional tool. Basically it was web-scraping project for downloading Japanese manga that had been translated into Chinese using Python. He forked spynner, made it “dumber” and called his fork “Punky Browster”. I don’t think this project is available yet.

To sign up to give lightning talks, they used a convore thread. The front row was made up of hecklers that would heckle the speakers. They seemed to favor strong swearing for the heckling. It could be pretty funny and very crude. I learned about a lot of new projects I had never heard of though. It’s definitely something that I think is worth checking out at least once.