#!/usr/bin/env python '''animalPmw animal GUI by Pmw ''' from Tkinter import Button, END, Label, W from Pmw import initialise, ComboBox, Counter top = initialise() lb = Label(top, text='Animals (in pairs; min:pair,max:dozen)') lb.pack() ct = Counter(top, labelpos=W, label_text='Number:', datatype='integer', entryfield_value=2, increment=2, entryfield_validate={ 'validator': 'integer', 'min': 2, 'max': 12 }) ct.pack() cb = ComboBox(top, labelpos=W, label_text='type:') for animal in ('dog', 'cat', 'hamster', 'python'): cb.insert(END, animal) cb.pack() qb = Button(top, text='QUIT', command=top.quit, bg='red', fg='white') qb.pack()
buttoncancel.pack(padx = 5, side = LEFT) def ok(self): crlevel = self.level.get() numrooms = self.totalrooms.get() self.top.destroy() self.command(numrooms, crlevel) def cancel(self): self.top.destroy() #about button: thanks to tkMessageBox def aboutbox(): tkMessageBox.showinfo("About","DungeonGenerator for Pathfinder, by Chris Pack. \n \n Enter your party level and the number of rooms in Generate. \n Hover over monster tokens for monster info. \n Special thanks to Alisa Pack, James Switzer, and Pasha Wrangell. \n Based on an algorithm by Gary Gygax.") top = Tk() tehframe = Frame(top) initialise(top)#Pmw: hovertext widget starter tehframe.pack(side = LEFT, fill = Y, expand = TRUE) #save picture files to variables stairs1 = PhotoImage(file = 'stairs1.gif') monster1 = PhotoImage(file = 'monster1.gif') settingsbox = levelselect(top, generatedungeon) #show hover text on monsters, tooltips thanks to PythonMegaWidgets balloon = Balloon(top)#Pmw: declare the hovertext balloon generatebutton = Button(tehframe, text="Generate", command = settingsbox.prompt) generatebutton.pack(side = TOP) aboutbutton = Button(tehframe, text = "About", command = aboutbox) aboutbutton.pack(side = TOP, fill = X, pady = 3)
#!/usr/bin/env python from Tkinter import Button, END, Label, W from Pmw import initialise, ComboBox, Counter top = initialise() lb = Label(top, text='animals (in pairs; min: pair, max: dozen)') lb.pack() ct = Counter(top, labelpos=W, label_text='number:', datatype='integer', entryfield_value=2, increment=2, entryfield_validate={'validator': 'integer', 'min':2, 'max':12}) ct.pack() cb = ComboBox(top, labelpos=W, label_text='type:') for animal in ('dog', 'cat', 'hamster', 'python'): cb.insert(END, animal) cb.pack() qb = Button(top, text='quit', command=top.quit, bg='red', fg='white') qb.pack() top.mainloop()
def cancel(self): self.top.destroy() #about button: thanks to tkMessageBox def aboutbox(): tkMessageBox.showinfo( "About", "DungeonGenerator for Pathfinder, by Chris Pack. \n \n Enter your party level and the number of rooms in Generate. \n Hover over monster tokens for monster info. \n Special thanks to Alisa Pack, James Switzer, and Pasha Wrangell. \n Based on an algorithm by Gary Gygax." ) top = Tk() tehframe = Frame(top) initialise(top) #Pmw: hovertext widget starter tehframe.pack(side=LEFT, fill=Y, expand=TRUE) #save picture files to variables stairs1 = PhotoImage(file='stairs1.gif') monster1 = PhotoImage(file='monster1.gif') settingsbox = levelselect(top, generatedungeon) #show hover text on monsters, tooltips thanks to PythonMegaWidgets balloon = Balloon(top) #Pmw: declare the hovertext balloon generatebutton = Button(tehframe, text="Generate", command=settingsbox.prompt) generatebutton.pack(side=TOP) aboutbutton = Button(tehframe, text="About", command=aboutbox) aboutbutton.pack(side=TOP, fill=X, pady=3)