Why do you need a macro for that? Why don't you just write
def start_window(name) :
app = wxPySimpleApp()
frame = MainWindow(None, -1, name)
frame.Show(True)
app.MainLoop()
return (app, frame)
Macros are used for other things!
In conjunction with wxWindows, macros are indeed useful. The C++
library itself has, for instance, a WX_IMPLEMENT_APP macro that
implements the application: you just name the root class. It also has
message map macros which bind messages by event and control ID to
class methods.
I started working on Lisp wrappers for wxWindows which provide Lisp
versions of these macros.
The example goes something like this:
(use-package :wx)
(defclass my-app (app) ())
(defclass my-frame (frame) ())
;; save command
(defmethod on-save ((frame my-frame) (event event))
(format t "my-frame:
n-save~%"))
;; print command
(defmethod on-print ((frame my-frame) (event event))
(format t "my-frame:
n-print~%"))
;; button click
(defmethod on-foo-clicked ((frame my-frame) (event event))
(format t "my-frame:
n-foo-clicked~%"))
;; Message map: Lisp macro.
(define-message-map my-frame
(menu-event
save on-save)
print on-print)
(command-event
foo on-foo-clicked))
(close-event on-close))
;; Application macro, just like in a WxWindows C++ program.
;; There has to be an ON-INIT method specialized for the MY-APP
class!
(implement-app my-app)
Note that instead of the integer control ID's used in the C++ realm,
we use keyword symbols! So there is nothing to declare. In ON-INIT,
you create the button with the control identifier :FOO, and that's
what you refer to in your map or elsewhere. Whereas the C++ programmer
has a silly chore of maintaining a header file that defines symbolic
constants for control ID's and things.
Writing the ON-INIT method in the application class is a chore,
because of the function call interface used for constructing the GUI.
This would be another good candidate for macrology. Ideally, there
should be a simplified description language which defines the elements
of the GUI, and is translated into the object constructor calls.
Wait, isn't this what resource files or scripts are in dumb
programming environments? These are just simplified, condensed
languages for defining GUI layouts so you don't have to write them in
the awful language you are using to develop the rest of the program.