PhpWikiGui

While fooling around with Tkinter and xmlrpclib in Python, I decided to try out the experimental XML-RPC Interface in the development version of PhpWiki:

from Tkinter import *
from xmlrpclib import ServerProxy

class wikiClient: def __init__(self): self.proxy = ServerProxy("http://phpwiki.sourceforge.net/demo/RPC2.php") self.initUi()

def initUi(self): """Lay out the GUI for the application.""" self.root = Tk() #Create a left-hand frame for the listbox self.lFrame = Frame(self.root) #Create a right-hand frame for the text widget self.rFrame = Frame(self.root) #Create the label for the listbox self.listBoxLabel = Label(self.lFrame,text="Available Pages:") #Create the listbox self.listBox = Listbox(self.lFrame,selectmode=SINGLE, height=30) #populate the listbox for page in self.getPageNames(): self.listBox.insert(END, page) #Create the 'Go' button self.goButton = Button(self.lFrame, text="Go!", command=self.getPageText) #Create the label for the text widget self.textLabel = Label(self.rFrame, text="Contents of the page you selected:") #Create the text widget self.text = Text(self.rFrame) #Pack widgets self.lFrame.pack(side="left",fill=BOTH) self.rFrame.pack(side="right",expand=1) self.listBoxLabel.pack(side="top", pady = 3) self.listBox.pack(side="top",padx=3, pady=3) self.goButton.pack(side="top", pady=3) self.textLabel.pack(side="top", pady = 3) self.text.pack(side="top", padx=3, pady=3, fill=BOTH) def getPageNames(self): """Connect to the server and get a list of all page names""" pageList = self.proxy.wiki.getAllPages() pageList.sort() return pageList

def getPageText(self): """Determine which item in the list is selected, and retrieve that page's raw Wiki text.""" selectedIndex = self.listBox.curselection()0 #Get the corresponding value: selectedPage = self.listBox.get(selectedIndex) #Get the contents of the page: pageContents = self.proxy.wiki.getPage(selectedPage) #Clear the text widget: self.text.delete(1.0, END) #Put the page name in the textbox self.text.insert(1.0, pageContents.data)

app = wikiClient() app.root.mainloop()

It looks like this in Windows98: