| 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 |
|
| 26 |
|
| 27 |
|
| 28 |
from fltk import * |
| 29 |
import sys |
| 30 |
|
| 31 |
|
| 32 |
fg = FL_BLACK |
| 33 |
bg = FL_WHITE |
| 34 |
cursor = FL_CURSOR_DEFAULT |
| 35 |
|
| 36 |
|
| 37 |
cursor_slider = '' |
| 38 |
|
| 39 |
def choice_cb(ptr, value): |
| 40 |
global cursor |
| 41 |
global fg |
| 42 |
global bg |
| 43 |
cursor = value |
| 44 |
cursor_slider.value(cursor) |
| 45 |
fl_cursor(cursor, fg, bg) |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
def setcursor(slider): |
| 50 |
global cursor |
| 51 |
global fg |
| 52 |
global bg |
| 53 |
|
| 54 |
cursor = int(slider.value()) |
| 55 |
fl_cursor(cursor, fg, bg) |
| 56 |
|
| 57 |
def setfg(slider): |
| 58 |
global cursor |
| 59 |
global fg |
| 60 |
global bg |
| 61 |
|
| 62 |
fg = int(slider.value()) |
| 63 |
fl_cursor(cursor, fg, bg) |
| 64 |
|
| 65 |
def setbg(slider): |
| 66 |
global cursor |
| 67 |
global fg |
| 68 |
global bg |
| 69 |
|
| 70 |
bg = int(slider.value()) |
| 71 |
fl_cursor(cursor, fg, bg) |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
class CharBox(Fl_Box): |
| 76 |
def __init__(self, X, Y, W, H, L): |
| 77 |
|
| 78 |
Fl_Box.__init__(self, X,Y,W,H,L) |
| 79 |
def draw(): |
| 80 |
fl_font(FL_FREE_FONT,14) |
| 81 |
fl_draw(label(), x()+w()/2, y()+h()/2) |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
window = Fl_Window(400,300) |
| 86 |
|
| 87 |
choice = Fl_Choice(80,100,200,25,"Cursor:") |
| 88 |
|
| 89 |
choice.copy( |
| 90 |
(( ("FL_CURSOR_DEFAULT",0,choice_cb,FL_CURSOR_DEFAULT), |
| 91 |
("FL_CURSOR_ARROW",0,choice_cb,FL_CURSOR_ARROW), |
| 92 |
("FL_CURSOR_CROSS",0,choice_cb,FL_CURSOR_CROSS), |
| 93 |
("FL_CURSOR_WAIT",0,choice_cb,FL_CURSOR_WAIT), |
| 94 |
("FL_CURSOR_INSERT",0,choice_cb,FL_CURSOR_INSERT), |
| 95 |
("FL_CURSOR_HAND",0,choice_cb,FL_CURSOR_HAND), |
| 96 |
("FL_CURSOR_HELP",0,choice_cb,FL_CURSOR_HELP), |
| 97 |
("FL_CURSOR_MOVE",0,choice_cb,FL_CURSOR_MOVE), |
| 98 |
("FL_CURSOR_NS",0,choice_cb,FL_CURSOR_NS), |
| 99 |
("FL_CURSOR_WE",0,choice_cb,FL_CURSOR_WE), |
| 100 |
("FL_CURSOR_NWSE",0,choice_cb,FL_CURSOR_NWSE), |
| 101 |
("FL_CURSOR_NESW",0,choice_cb,FL_CURSOR_NESW), |
| 102 |
("FL_CURSOR_NONE",0,choice_cb,FL_CURSOR_NONE), |
| 103 |
(None,) ) )) |
| 104 |
choice.callback(choice_cb) |
| 105 |
|
| 106 |
|
| 107 |
slider1 = Fl_Hor_Value_Slider(80,180,310,30,"Cursor:") |
| 108 |
cursor_slider = slider1 |
| 109 |
slider1.align(FL_ALIGN_LEFT) |
| 110 |
slider1.step(1) |
| 111 |
slider1.precision(0) |
| 112 |
slider1.bounds(0,100) |
| 113 |
slider1.value(0) |
| 114 |
slider1.callback(setcursor) |
| 115 |
slider1.value(cursor); |
| 116 |
|
| 117 |
slider2 = Fl_Hor_Value_Slider(80,220,310,30,"fgcolor:") |
| 118 |
slider2.align(FL_ALIGN_LEFT) |
| 119 |
slider2.step(1) |
| 120 |
slider2.precision(0) |
| 121 |
slider2.bounds(0,255) |
| 122 |
slider2.value(0) |
| 123 |
slider2.callback(setfg) |
| 124 |
slider2.value(fg) |
| 125 |
|
| 126 |
slider3 = Fl_Hor_Value_Slider(80,260,310,30,"bgcolor:") |
| 127 |
slider3.align(FL_ALIGN_LEFT) |
| 128 |
slider3.step(1) |
| 129 |
slider3.precision(0) |
| 130 |
slider3.bounds(0,255) |
| 131 |
slider3.value(0) |
| 132 |
slider3.callback(setbg) |
| 133 |
slider3.value(bg) |
| 134 |
|
| 135 |
window.resizable(window) |
| 136 |
window.end() |
| 137 |
window.show(len(sys.argv),sys.argv) |
| 138 |
Fl.run() |