Friday, February 1, 2008

Widget Class

So you're programming a game or doing something using pygame. You have need to input a string so you can perhaps save a file or enter your new high score. How does one do this without using input or raw_input? Well if you have knowledge of the Tkinter library and the widgets it provides you may also know that it seems difficult to make Tkinter work with pygame (or at least that is my experience... maybe I just don't know how to focus a Tkinter widget). I have started work on some widgets like Entry and Label and Button. It uses pygame to draw the widget and the class for each of these has parameters that are defaults but it requires the class to be called with screen and background instances, which isn't a huge deal, it's just helpful to know.


I have updated my file to include buttons and a label. Go here to see the new and improved version. There will be regular updates as Idubug and meticulously include more features. I may just limit this library to Entry, Button and Label until such a time as I need more things like menus and such.


No comments: