Wax
Report written by LionKimbro, on 2003-09-20. Please correct errors & omissions. I have not yet downloaded and applied Wax.
Updated a little by Joanna on 13 November 2004. I distribute a project (http://www.cs.bath.ac.uk/~jjb/web/pyposh.html) one of my students used wax in.
When/if Wax has more web presence, please completely rewrite this page.
Contents
Project Summary
Static Information: http://zephyrfalcon.org/labs/dope_on_wax.html
Downloads: http://zephyrfalcon.org/download/
Wax is a friendly layer atop wxPython.
RobinDunn is trying to keep wxPython close to wxWindows, but believes there is room for a layer on top, to make wxPython more python-ic.
Wax appears to be trying to fit that role.
Project Author
Name: HansNowak
Blog has moved here: http://zephyrfalcon.org/weblog2/
Status
As of 2003-09-20 (with Nov 04 updates):
Wax does not appear to be documented, however, there are a lot of sample snips on the blog.
Judging by the blog, the author seems to have worked on Wax in May (5), August (8), and September (9), of 2003, indicating continuing development. The downloads page actually has more versions (and more recent versions) than the blog indicates. Current most recent is September 2004. Blog indicates development is to keep up with new versions of wxPython.
KevinAltis has posted to the blog, indicating that there's some awareness in the wxPython community of wax. However, this is the first entry on this wiki about it. There are no entries in the wxPython-users mailing list to date about it either.
Sample Code
Copied from part 1 of the Wax Primer:
1 from wax import *
2
3 FIXED_FONT = Font('Courier New', 10)
4
5 class MainFrame(Frame):
6
7 def Body(self):
8 self.filename = None
9 self.CreateMenu()
10 self.textbox = TextBox(self, multiline=1, wrap=0)
11 self.textbox.SetFont(FIXED_FONT)
12 self.AddComponent(self.textbox)
13
14 def CreateMenu(self):
15 menubar = MenuBar()
16
17 menu1 = Menu(self)
18 menu1.Append("&New", self.New, "Create a new file")
19 menu1.Append("&Open", self.Open, "Open a file")
20 menu1.Append("&Save", self.Save, "Save a file")
21
22 menubar.Append(menu1, "&File")
23
24 self.SetMenuBar(menubar)
25
26 def New(self, event):
27 self.textbox.Clear()
28 self.filename = None
29
30 def Open(self, event):
31 dlg = FileDialog(self, open=1)
32 try:
33 result = dlg.ShowModal()
34 if result == 'ok':
35 filename = dlg.GetPaths()[0]
36 self._OpenFile(filename)
37 finally:
38 dlg.Destroy()
39
40 def _OpenFile(self, filename):
41 self.filename = filename
42 f = open(filename, 'r')
43 data = f.read()
44 f.close()
45 self.textbox.Clear()
46 self.textbox.AppendText(data)
47
48 def Save(self, event):
49 if self.filename:
50 self._SaveFile(self.filename)
51 else:
52 dlg = FileDialog(self, save=1)
53 try:
54 result = dlg.ShowModal()
55 if result == 'ok':
56 filename = dlg.GetPaths()[0]
57 self.filename = filename
58 self._SaveFile(filename)
59 finally:
60 dlg.Destroy()
61
62 def _SaveFile(self, filename):
63 f = open(filename, 'w')
64 f.write(self.textbox.GetValue())
65 f.close()
66
67 app = Application(MainFrame, title="A simple editor")
68 app.Run()