| 1 | #!/usr/bin/python |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | |
| 5 | # |
| 6 | # "$Id: hello.py 276 2006-11-13 11:01:40Z andreasheld $" |
| 7 | # |
| 8 | # Callback test program for pyFLTK the Python bindings |
| 9 | # for the Fast Light Tool Kit (FLTK). |
| 10 | # |
| 11 | # FLTK copyright 1998-1999 by Bill Spitzak and others. |
| 12 | # pyFLTK copyright 2003 by Andreas Held and others. |
| 13 | # |
| 14 | # This library is free software you can redistribute it and/or |
| 15 | # modify it under the terms of the GNU Library General Public |
| 16 | # License, version 2.0 as published by the Free Software Foundation. |
| 17 | # |
| 18 | # This library is distributed in the hope that it will be useful, |
| 19 | # but WITHOUT ANY WARRANTY without even the implied warranty of |
| 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | # Library General Public License for more details. |
| 22 | # |
| 23 | # You should have received a copy of the GNU Library General Public |
| 24 | # License along with this library if not, write to the Free Software |
| 25 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 26 | # USA. |
| 27 | # |
| 28 | # Please report all bugs and problems to "[email protected]". |
| 29 | # |
| 30 | |
| 31 | from fltk import * |
| 32 | import sys |
| 33 | from string import * |
| 34 | |
| 35 | def theCancelButtonCallback(ptr, data): |
| 36 | print("type = ", type(ptr)) |
| 37 | print(f"theCancelButtonCallback({str(data)})") |
| 38 | print("Tooltip: ", ptr.tooltip()) |
| 39 | |
| 40 | window = Fl_Window(100, 100, 200, 90) |
| 41 | window.label(sys.argv[0]) |
| 42 | button = Fl_Button(9,20,180,60) |
| 43 | utfstr = "日本語" |
| 44 | extra_font = FL_TIMES_BOLD_ITALIC |
| 45 | #Fl.set_font(extra_font, "*gothic*iso10646-1") |
| 46 | Fl.set_font(extra_font, "*gothic-medium-r-normal*") |
| 47 | Fl_Tooltip.font(extra_font) |
| 48 | |
| 49 | button.labelfont(extra_font) |
| 50 | button.labelsize(30) |
| 51 | button.label(utfstr) |
| 52 | button.labeltype(FL_EMBOSSED_LABEL) |
| 53 | button.callback(theCancelButtonCallback, "'some callback data'") |
| 54 | button.callback(theCancelButtonCallback, "'任意のデータ'") |
| 55 | #button.tooltip("Press to see the callback!") |
| 56 | button.tooltip("データを見るため押して下さい。") |
| 57 | |
| 58 | window.end() |
| 59 | window.show(sys.argv) |
| 60 | Fl.run() |