| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
from fltk import * |
| 26 |
import time, string |
| 27 |
|
| 28 |
window = None |
| 29 |
fullscreen = 0 |
| 30 |
label = "" |
| 31 |
|
| 32 |
def cb(ptr, data): |
| 33 |
print(data) |
| 34 |
|
| 35 |
def full_cb(ptr): |
| 36 |
"toggle fullscreen" |
| 37 |
global fullscreen |
| 38 |
if fullscreen == 0: |
| 39 |
fullscreen = 1 |
| 40 |
window.fullscreen() |
| 41 |
else: |
| 42 |
fullscreen = 0 |
| 43 |
window.fullscreen_off(100,100,300,300) |
| 44 |
|
| 45 |
def resize_cb(ptr, data): |
| 46 |
"grow/shrink the window" |
| 47 |
window.resize(window.x(), window.y(), window.w()+10*data, |
| 48 |
window.h()+10*data) |
| 49 |
|
| 50 |
def iconize_cb(ptr): |
| 51 |
"iconize the window" |
| 52 |
window.iconize() |
| 53 |
|
| 54 |
def hotspot_cb(ptr): |
| 55 |
"move the window to the hotspot" |
| 56 |
window.hotspot(10,10) |
| 57 |
|
| 58 |
def label_cb(ptr): |
| 59 |
"change the label of the window, variable label must be global" |
| 60 |
global label |
| 61 |
label = "Another "+window.label() |
| 62 |
window.label(label) |
| 63 |
|
| 64 |
window = Fl_Window(300,300) |
| 65 |
window.label("Window Test") |
| 66 |
|
| 67 |
window.size_range(100,100,500,500,10,10,1) |
| 68 |
|
| 69 |
b1 = Fl_Button(10,10,80,25,"Fullscreen") |
| 70 |
b1.callback(full_cb) |
| 71 |
|
| 72 |
b2 = Fl_Button(100,10,80,25,"Grow") |
| 73 |
b2.callback(resize_cb, 1) |
| 74 |
|
| 75 |
b3 = Fl_Button(190,10,80,25,"Shrink") |
| 76 |
b3.callback(resize_cb, -1) |
| 77 |
|
| 78 |
b4 = Fl_Button(10,45,80,25,"Iconize") |
| 79 |
b4.callback(iconize_cb) |
| 80 |
|
| 81 |
b5 = Fl_Button(100,45,80,25,"Hotspot") |
| 82 |
b5.callback(hotspot_cb) |
| 83 |
|
| 84 |
b6 = Fl_Button(100,45,80,25,"Label") |
| 85 |
b6.callback(label_cb) |
| 86 |
|
| 87 |
window.show() |
| 88 |
|
| 89 |
window.hotspot(100,100) |
| 90 |
|
| 91 |
Fl.run() |