Tkinter and gridding.

Like I said on my twitter and reddit post, I’ve got a tricky question. How do you get a widget in a frame to fill another frame, without black magic?

Have to make a text tagging tool

This tool is going to be for my story book application.

What it’s going to do is ask for a project file or make a new one, and all that file is is a preset set of tags.

Then once you open the very simple editor, you’re going to be able to write text in premade tags, dictated by the project file, which will be saved in a format which could be parsed by a program.

I’m not sure but I’m pretty sure this is exactly what xml is but I really have no idea, so I’m just forging through!

If you know of a kind of program I’m looking for though, lemme know.


Also, I’ve started using my Twitter (@tankorsmash) more so hopefully that will help me with things. I’m pretty new to it, so I’ll probably just use hashtags for everything. I’m using Plume for android. It’s pretty neat.

P:S Temporary Hiatus – Choose Your Own Ending!

Started working on a school project, which is going to be a choose your own ending story, but the catch is I’m making it in python+tkinter instead of on paper.

This is special for a few reasons, one, it’s something I HAVE to finish, but also, one that I am especially trying to make look good, and planned out. In fact, this is the first time I drew up some design docs just for the layout, and so far it’s matching really well.

What I’ve learned so far has been fairly basic, but I’m still sorta new to tkinter. I’ve learned how to use radiobuttons, different frames and hiding them, and tkVars so far. On top of that, this is the first time I’m doing anything with my own code, rather than following a tutorial and branching off into my own, so that’s really nice.

It’s gonna be something like a title screen with an image and label, onto a ‘page’ with the text and choices below, with a history bar to the right, allowing quick page changes, to any section of the story. That history bar is actually what I’m going to start on now, since I’ve got no idea what the proper name for that even is…

Turns out it was a list box. I need a listbox.

Here’s where I’m at now, check it out top left to right:

CHOOSE YOUR FIGHT updating for threading

So it looks like I’mna have to make a GUI class instead of trying to work without one, my understanding of locals vs globals is certainly not nearly complete enough, and it just seems easier.

Unfortunately I’m going to use threading instead of multi threading or whatever module is builtin on top of it, just because it it simple enough for now, and I really just need to get a good grip on what it means to have threads.

Multi threading

I’m trying to get a GUI going with my game, mostly for debugging and that kind of stuff, but I ran into the very common issue where my game hangs on the initialization of tkinter. So I had to look into threading, which is apparently very easy in Python.

I’m using the Programming Python books, by Mark Lutz (O’REILLY pub) and it’s got a fairly good look at the basic concepts so far. Here’s something I wrote for myself, that I used to get a decent handle of threads, using the threads module in py2.6. What it does it changes the color of the background in the pygame window, and when you open the tkinter window, you can set that color in real time, without any hangs. It’s pretty neat, and I’m looking forward to adding it into my main game.

I’m still sorta getting the hang of lambdas only because it does seem to look right to me, even if I use them properly. I’ve got a line that goes:

root.bind('<Return>', (lambda event: printEnt(ent)))

And I don’t know why


isn’t given properly and there’s no exception raised…


Oh well, there’s always tomorrow.