Tao of the Machine

Programming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.

Can't stop the bumrush

I'm currently working on a little file explorer app. It may or may not end up being useful, but more important is that hacking on GUI apps helps me improve Wax. In version 0.1.42, two new objects were added: FileTreeView and ImageList.

To find out how they work, see the demo. (Which is really a rough draft for my application.)

Posted by Hans Nowak on 2003-11-27 23:31:05   {link}
Categories: Wax

Re: Snarls

Some thoughts about people's comments on my earlier Snarls of Defiance post.

"However, a job as a M$ developer tapping away with shitty technology is probably far better than not having a job at all. And if you have a family to feed, money probably matters even more." • Agreed, but the problem is more, how to find this shitty job. After all, some jobs require 5 years of C# experience. <0.3 wink> Since I have only a little experience with C#/.NET/VB/Visual Studio/Java/etc, I am not the ideal candidate, which makes it difficult to get hired, especially during a recession. It's not that I haven't tried to apply for such jobs... :-/

Part of the problem is that I'm spoiled. After two years of (professional) Python development, even Delphi seems clumsy and obnoxious.

"You could gang up with some like-minded people and start a business?" • Yes, I've been thinking about that. In theory it's really easy to start a business... all you need is customers who want tailor-made programs, and you make it for them. Using Python, I am likely to out-develop the more conservative competition. There's one problem though... where do I find these customers? Where I live isn't exactly the technological hotbed of the US. Gainesville may be a better area to find potential customers, but how will they know that I exist? Lacking commercial experience, I don't have the answer to that question. Traditional marketing wisdom may be "pick some companies and write them" or even "spam them", but that just doesn't seem right.

Some people found me via my site, but so far that hasn't led to anything (except a tiny project earlier this year, ~13 hours). I cannot afford to wait for people to find me. But what would be a good way to point out to them that I exist?

Posted by Hans "hmm, I will also need a company name" Nowak on 2003-11-26 21:02:39   {link}
Categories: general, programming

Waxy Fruvous

Wax 0.1.40 is available. I noticed that it didn't have a CheckBox and RadioButton yet, which I apparently overlooked. So those have been added now.

Also, I'm trying to get GroupBox (wxStaticBox in wxPython) to work. Something's missing, but I don't know what. If you're interested in helping, here's the idea: Look at the wxPython demo, under RadioButton. The demo groups radiobuttons nicely, but the code is kind of a mess, using various sizers. I want to achieve the same effect without explicit sizers.

The code I have so far is in groupbox.py, containers.py (GroupBoxContainer) and examples/groupbox1.py. It works "almost", but not quite... it's like the radiobuttons are placed outside of the GroupBox. Which is probably what happens, but I can't figure out how to get them in the right place. Any help is welcome.

Posted by Hans Nowak on 2003-11-25 20:26:01   {link}
Categories: Wax

It's the new style

Where Hans uses somebody else's post for shameless Python evangelism...

Kasia Trapszo: The neverending story. In this post, she describes how she has 5 personal projects. Some quotes:

"Anyone who has better time management skills than your average five year old realizes that it's better to finish something before starting a new project. The biggest time-sucker is finding that particular spot where you left off the last time you worked on the task."

"I get bored easily. If I work on something for too long and don't have quick gratification of immediate results I tend to get bored with the task. That's a terrible trait in a programmer.. after all.. any decent-sized project takes weeks before you start seeing a result! Hours upon hours of work."

"[...] while that's a noble idea, I really dont' think it's realistic on a large scale.. you would have to sacrifice good design and scalability to achieve that." (in comments, in reply to someone who suggests XP and agile programming)

No offense, but this is one of the reasons why I really don't want to mess with a language like Java or C#, if given a choice. I'm sorry, but all these problems don't occur with Python. Getting back into old code is a piece of cake. No quick gratification? Readers may remember my "one-day-projects"; the idea is to get a working proof of concept in a day, and so far, it has worked very well, also for non-trivial projects.

I get bored easily too, and granted, this *is* a problem when using languages where you cannot work so fast. That's why I'm glad I found Python. Not because it's the latest fad, or because it's exotic, or because company X or manager Y tells me to use it, but because it "just works".

Of course, it works best if you get rid of the oldfashioned idea that you have to know everything beforehand, before you start coding. A well-fleshed-out design is a nice thing to have if you use a (compiled) language where changes are costly. Imagine that your carefully crafted class hierarchy, with all its final and virtual and private methods, turns out to be incorrect. However, to me, as a Pythonista, "design" means "the vague idea you have about what the program could be like". I just start somewhere. Having actual code is the quickest and best way to find out if an idea works or not. It isn't right? No problem, often it won't take more than half an hour or so to change everything around, add a new class, modify the design, etc. Tests will help you here, of course, so you know what code will break when you make these changes. This is not "sacrificing good design"... it's a *different* form of design, where you shape the program as you go.

I currently have 15+ personal (Python) projects, and counting. This is not a daunting number at all... I just pick up a project when I feel like working on it. This has not been a problem so far, and I don't expect it will be. It matches the way I work and think, which IMHO is a good trait for a programming language, as opposed to being at odds with it.

Posted by Hans Nowak on 2003-11-24 21:19:26   {link}
Categories: Python

Movie reviews

Saw two movies recently, Cat in the Hat and Elf. Both of these are supposedly funny and suitable for a young audience (which is why we brought kids). Here's a quick impression.

Cat in the Hat: Not good. The Cat in the Hat books are funny, but short, and rightfully so -- there's simply not enough substance to fill a thick book, or a long movie. On top of that, it just wasn't funny. Sure, there were a few good moments... but overall, it just wasn't done right. The characters and the world are unappealing and unrealistic; the latter may be true to the CITH format, but it doesn't carry the movie. The unpredictable and nonsensical cat is occasionally funny, but it gets tiresome real quick when you have to watch him for over an hour. All in all, a missed opportunity.

Elf: Much better. I didn't think it would be much, judging from the silly movie poster, but I was pleasantly surprised. It starts out in a fairytale world, a bit like CITH, but doesn't stay there. The 30-year-old elf (as in: Santa's helper) Buddy travels to New York to meet his father, a hard businessman. Buddy has never been in the human world, and sure enough, this makes for a lot of comical situations. Understandably, his father thinks he's a nut, and has him thrown out of the building. A DNA test tells him the shocking truth, that Buddy is indeed his son, and he is forced to take him into his home, where his wife and son are more open to the idea of accepting him.

The story isn't very deep -- Buddy meets his father, eventually gets him to accept him, and saves Christmas along the way. People who like stories where the boy gets the girl (or vice versa) don't need to worry either. So, it's nothing revolutionary. But for some reason, this movie "works", while CITH did not. I'm not sure why... in my opinion, Elf is funnier than CITH, and you can also identify with the characters, who are less "flat" than in the Cat.

If you movie theater shows both, do yourself a favor and pick Elf.

Posted by Hans Nowak on 2003-11-24 20:44:34   {link}
Categories: general

OverlayPanel

In Delphi, the TabbedNotebook control can optionally be displayed without tabs. wxPython's Notebook doesn't seem to have this ability, most likely because the wxWindows Notebook doesn't support it. So I wrote my own version for Wax.

The new control is called an OverlayPanel, by lack of a better name. It's simple to use; you just add windows to it (anything that derives from wxWindow, much like a NoteBook). By default these windows will be hidden. With the Select() method you can pick one to be shown.

What good is this? In Delphi, the notebook-without-tabs is often used to display different information in the same panel. Usually, the window/form has a main area, and depending on what menu option you choose, different information and controls appear there. In Wax, I needed it for a Wizard control. (I will not derive from wxWizard, but rather try to come up with a more Pythonic control.)

Download the experimental Wax version 0.1.37 here. And here's some sample code illustrating its usage.

# overlay1.py

from wax import *

class MainFrame(Frame):
    def Body(self):
        self.toolbar = self.MakeToolbar(self)
        self.AddComponent(self.toolbar, border=1)
    
        self.op = OverlayPanel(self)
        self.op.SetSize((400,300))
        self.AddComponent(self.op)

        for s in (
            'Joho en een fles prik',
            'Blah blah...',
            'Sleeze beez',
            'This is a really long text for you',
        ):
            win = self.GenWindow(self.op, s)
            self.op.AddComponent(win)
            
        self.op.Select(0)
        
        self.Pack()
        
    def GenWindow(self, parent, text):
        p = Panel(parent)
        p.SetBackgroundColour((0, 0, 127))
        b = Button(p, text)
        p.AddComponent(b, border=20)
        p.Pack()
        return p
        
    def MakeToolbar(self, parent):
        p = Panel(parent, direction='h')
        for i in range(4):
            def f(event, self=self, i=i):
                self.op.Select(i)
            b = Button(p, "Select %d" % (i,), event=f)
            p.AddComponent(b)
        p.Pack()
        return p
        

if __name__ == "__main__":

    app = Application(MainFrame, title='test test...', direction='v')
    app.Run()

Ultra-short usage example:

op = OverlayPanel(parent)
op.AddComponent(window1)
op.AddComponent(window2)  # ...etc...
op.Select(0)  # select first window

GenWindow is just a quick way to create separate windows, and MakeToolbar creates a toolbar with buttons that cause selected windows to appear in the OverlayPanel.

Important note: I had to write my own sizer, to be used by the OverlayContainer control, which in turn is the basis for the OverlayPanel. I don't know much about sizers, so wxPython adepts, if you see anything strange/missing, or have suggestions for improvement, then I'd love to hear about it. Also, this Container's AddComponent method doesn't have the usual options (expand, align, etc) that other versions have. I'd like to hear if/how these can be implemented. It does now. Check out version 0.1.38.

Posted by Hans Nowak on 2003-11-24 16:14:40   {link}
Categories: Wax

Short manga descriptions (2)

More manga descriptions. I'm not so good at this, and I'm running out of interesting mangas, so this will be the last post of its kind for a while. Gomen, gomen...

11. Hajime No Ippo: Boxing manga. Shy guy (Ippo) is picked on, professional boxer helps him (well, kind of) and takes him to the boxing gym. Ippo seems not devoid of talent, and he stays. He proceeds to win official fights and even championships. ... I don't know much about boxing, but this manga seems fairly realistic, correctly depicting the hard work and training necessary for becoming a successful boxer.

12. Lilim Kiss: Sappy, but not uninteresting story about a demon (looking like a cute girl with bat's wings) visits the earth, where she meets a guy that she likes. Slight complications occur because she eats by kissing a person, which drains their life energy.

13. Mahou Sensei Megima: Described as "Love Hina meets Harry Potter", and this seems indeed the case. As his final task to become a wizard, a 10-year-old boy starts working as a teacher at a girl's high school.

14. Penguin Brothers: Girl arrives at a new high school, to find that the students have divided in two major groups, black and white (indicated by the uniform they wear), who are at odds with each other. Determined to change this, she a third faction, the greys (which up until then had only one member :-). Much of the manga is about her efforts to recruit grey members, and the existing anomosity between the leaders of the blacks and the whites.

15. Psychometrer Eiji: Adolescent boy has a special gift, "psychometry", which enables him to touch objects and see images in his head, related to the object. Together with a female police inspector, he solves a lot of (murder) mysteries. Can be quite gory and sometimes ecchi.

16. Yakitate! Japan: Some mangas have unusual topics, and this is one of them. It's about a boy baking bread. As often with "dedicated" mangas, a lot of detail is spent on the description of different breads, how to bake them, etc.

17. Love Hina: As little children, a boy and a girl vowed that they would meet again at Toudai (Tokyo University). Years later, Keitaro, the boy, struggling to get into university, is looking for a place to live, and he goes to the old inn/bathing house owned by his grandmother. Turns out a few things have changed; the inn is now for girls only, and Keitaro has a few unfortunate encounters with the current inhabitants, causing him to get slapped around quite a bit. The rest of the manga (and anime) is much in the same spirit.

18. Rurouni Kenshin: After Japan has been torn by war, the last of a special class of samurai retires to live a peaceful life, vowing never to kill again. He uses a special sword, made to deflect rather than kill. Keeping the vow becomes difficult since quite a few people seem to have a bone to pick with him.

19. Shaman King: High-strung school boy befriends an aspirant shaman, someone who can talk to spirits and conjure them. A tiny bit like Pokemon: shamans can let a spirit possess them and have "shaman fights" in a tournament, to determine who will be the Shaman King.

20. Nausicaa: Good manga, kind of surrealistic. In a strange world threatened by war, a girl goes on a quest to help her people. (If that sounds vague... read the manga emoticon:smile or watch the anime.)

Posted by Hans Nowak on 2003-11-22 18:09:59   {link}
Categories: manga

--
Generated by Firedrop2.