Friday, January 8, 2010

photobomb can has lolz

Tonight's Photobomb Feature: Text

Tonight I add the ability to add text. You can also change the set the font and color. You can change the size just by growing the size of the object with the size buttons I added initially.

I also added the ability to edit items after you've added them. That is you can change the color of most objects, and the width of your ink strokes. You can't edit the text once you've added it, but I suppose I could add the pretty easily as a feature some night.

Tonight I wrote the first piece of code that suggested extending goocanvas namespace types rather than writing the program in a more procedural style. When changing colors, for most objects, you want to change the fill_color property. But for ink, you want to change the stroke_color property. So I added some code to detect the type and set the right property as needed.

       if type(self.selected_item) == goocanvas.Path:

Typically, when I find myself detecting types and branching, it's not long before I start sub-classing instead. However, when I look at the goocanvas reference it seems that there are limited objects, and perhaps a procedural style will hold out.


  1. Nice article, thanks for the information. It's very complete information. I will bookmark for next reference
    jaring futsal | jaring golf | jaring pengaman proyek |
    jaring pengaman bangunan | jaring pengaman gedung