Well I know there's a big interest in building a Linux app. So I took some time to write a little tutorial using python+pygame. This is just comments in my source code. coding a GUI app using pygame has its learning curve and its even worse if you've never coded a GUI app before. Don't think you know how to code a GUI app just cause you know VB cause that does all the event handling for you pretty much. At least off the keyboard and mouse.
What you'll need to run this?
SDL
SDL_tff <-- you'll need that once you get going
python v2.2 or 2.3
pygame
This source code will also work on windows. So if your in windows and want to learn python+pygame you have that option if you want to move to Linux one day.
I don't really expect to many people to help me with this app but some have said they are interested. It took me about a week of playing around with python and pygame to really learn what is doing on and how to do things.
So here is a simple app. It will create a blank screen and you have the option to see how events are handles.. IE keyboard events.. button down and button up and how they are mapped and how you cycle through a stack of events. python is really easy to pick up.
Code:
# This imports all of the pygame methods we need
import pygame;
# This handles all of the vars we need like KEYUP, KEYDOWN
# It pretty much maps the keyboard and mouse out for us.
from pygame.locals import *
def main():
# These next three lines just init the pygame object
# and also load a sdl screen.
pygame.init()
window = pygame.display.set_mode((200,200))
pygame.display.set_caption('Media-Z')
# This is the main loop. This will just keep the program
# running till we control+c out of it in a terminal window
while 1:
# This grabs the events we input into the window
# It can be a mouse movement or keyboard
events = pygame.event.get()
# This goes through the array we created and processes
# each value in the array
for event in events:
# if the event is a keypress
if event.type == KEYDOWN:
# This prints the ascii key value of the key we pressed
# Also in pygame.locals K_a = 97 and if you hit a you'll
# notice event.key = 97. This is the same for K_F1, K_ENTER, K_DOWN
# So you can either map to the number or variable.
print "KeyDown", event.key
print "K_a is ", K_a
# If the event is a key release
if event.type == KEYUP:
# This prints the ascii key value of the key we pressed
print "KeyUp", event.key
# This is where the program will run. It calls the function main()
if __name__=='__main__':
main()
I have also attached the code