From: Andrew M. Kuchling Date: Tue, 2 Aug 2005 17:20:36 +0000 (+0000) Subject: Add example X-Git-Tag: v2.5a0~1546 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6af7fe056387be32ff280f7e86d538ff9ea8c8e2;p=python Add example --- diff --git a/Doc/whatsnew/whatsnew25.tex b/Doc/whatsnew/whatsnew25.tex index 3b07b10f5b..4bd380aa1f 100644 --- a/Doc/whatsnew/whatsnew25.tex +++ b/Doc/whatsnew/whatsnew25.tex @@ -60,9 +60,21 @@ def log (message, subsystem): server_log = functional.partial(log, subsystem='server') \end{verbatim} -Here's another example, from a program that uses PyGTk. +Here's another example, from a program that uses PyGTk. Here a +context-sensitive pop-up menu is being constructed dynamically. The +callback provided for the menu option is a partially applied version +of the \method{open_item()} method, where the first argument has been +provided. -% XXX add example from my GTk programming +\begin{verbatim} +... +class Application: + def open_item(self, path): + ... + def init (self): + open_func = functional.partial(self.open_item, item_path) + popup_menu.append( ("Open", open_func, 1) ) +\end{verbatim} \begin{seealso}