A simple Tkinter demo to display a window with some buttons on it for a front end installer app. The buttons just quit in this example, but you can see the event handlers towards the bottom that would make it easy to tweak. I’m still looking for a gui builder for Tkinter, because gui design changes can be a pain and I know the requirements will change while i’m developing code. I like calling python via env, works on multiple systems where python might be installed in local or elsewhere…
#!/usr/bin/env python
from Tkinter import *
class InstallerGUI(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.installButton = Button(self)
self.installButton['text'] = 'Install the latest version'
self.installButton['anchor'] = 'nw'
self.installButton['width'] = 35
self.installButton['command'] = self.quit
self.installButton.pack(side=LEFT)
self.installButton.bind("<Button-1>", self.installButton_Click)
self.revertButton = Button(self)
self.revertButton['text'] = 'Revert to a previous installation'
self.revertButton['anchor'] = 'nw'
self.revertButton['width'] = 35
self.revertButton['command'] = self.quit
self.revertButton.pack(side=LEFT)
self.revertButton.bind("<Button-1>", self.revertButton_Click)
self.helpButton = Button(self)
self.helpButton['text'] = 'Help'
self.helpButton['anchor'] = 'nw'
self.helpButton['width'] = 35
self.helpButton['command'] = self.quit
self.helpButton.pack(side=LEFT)
self.helpButton.bind("<Button-1>", self.helpButton_Click)
self.quitButton = Button(self)
self.quitButton['text'] = 'Quit'
self.quitButton['anchor'] = 'nw'
self.quitButton['width'] = 35
self.quitButton['command'] = self.quit
self.quitButton.pack(side=LEFT)
def installButton_Click(self, event):
pass
def revertButton_Click(self, event):
pass
def helpButton_Click(self, event):
pass
app = InstallerGUI()
app.master.title("MyWickedApp")
app.mainloop()
Update: I ended up going with pyGTK. Although this will work, I think utilizing the GTK+ libraries will be better in the long run with developing other apps…