aboutsummaryrefslogtreecommitdiff
path: root/Python/demos/testGraphics.py
blob: 5f22f9f22b319f2dc1dafa1b5bd6a07677ad8ba7 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#-----------------------------------------------------------------------------------
#
#      testGraphics.py
#      Fichier test du module Graphics
#
#      Authors: Jean-Luc Vinot <vinot@cena.fr> Guilaume Vidon <vidon@ath.cena.fr>
#
# $Id$
#-----------------------------------------------------------------------------------
import sys

try :
    import IPython.ultraTB
    sys.excepthook = IPython.ultraTB.FormattedTB(mode = 'Verbose',
                                                 color_scheme = 'Linux',
                                                 call_pdb = 1)
except ImportError:
    pass

VERSION = "1.13"

import Tkinter
import Zinc
import Zinc.pictorial as pictorial 
from Zinc.geometry import *
from Zinc.graphics import  build_zinc_item, tabbox_coords, lpts2coords, coords2lpts
import math
import getopt

currenttransfo = None
previousangle = 0
rotate_angle = .1
zoomfactor = .1
curview = None
dx,  dy = 0, 0

tabanchor = 'n'
tabalign = 'left'

font_9b = '7x13bold'
# the original font is not standard, even if it is fully free:
# font_9b = '-cenapii-bleriot mini-bold-r-normal--9-90-75-75-p-75-iso8859-15'

gradset = {
    'boitonglet' : '=axial 0|#ff7777|#ffff99',
    'roundrect1' : '=axial 270|#a7ffa7;70 0|#ffffff;90 5|#00bd00;80 8|#b7ffb7;50 80|#ffffff;70 91|#00ac00;70 95|#006700;60 100',
    'roundrect2' : '=axial 270|#00bd00;80 |#d7ffd7;60',
    'roundrect3' : '=axial 270|#00bd00;100 0|#ffffff;100 14|#ffffff;100 16|#00bd00;90 25|#b7ffb7;60 100',
    'roundrect4' : '=axial 0|#00bd00;100 0|#ffffff;100 20|#00bd00;50 30|#00bd00;90 80|#b7ffb7;60 100',
    'roundrect4ed' : '=path 48 48|#e7ffe7;20 0 70|#007900;20',
    'roundcurve2' : '=axial 270|#d7ffd7;60|#7777ff;80',
    'roundcurve1' : '=axial 270|#2222ff;80 |#d7ffd7;60',
    'roundcurve' : '=axial 270|#7777ff;80 |#d7ffd7;60',
    'roundpolyg' : '=radial -15 -20|#ffb7b7;50|#bd6622;90',
    'rpolyline' : '=axial 90|#ffff77;80 |#ff7700;60',
    'pushbtn1' : '=axial 0|#cccccc;100 0|#ffffff;100 10|#5a5a6a;100 80|#aaaadd;100 100',
    'pushbtn2' : '=axial 270|#ccccff;100 0|#ffffff;100 10|#5a5a7a;100 80|#bbbbee;100 100',
    'pushbtn3' : '=radial -15 -15|#ffffff;100 0|#333344;100 100',
    'pushbtn4' : '=axial 270|#ccccff;100 0|#ffffff;100 10|#7a7a9a;100 80|#bbbbee;100 100',
    'conical_edge' : '=conical 0 0 -45|#ffffff;100 0|#888899;100 30|#555566;100 50|#888899;100 70|#ffffff;100 100',
    'conical_ext' : '=conical 0 0 135|#ffffff;100 0|#777788;100 30|#444455;100 50|#777788;100 70|#ffffff;100 100',
    'pushbtn_edge' : '=axial 140|#ffffff;100 0|#555566;100 100',
    'pushbtn_edge2' : '=axial 92|#ffffff;100 0|#555566;100 100',
    'logoshape2' : '=axial 270|#ffffff|#7192aa',
    'logopoint2' : '=radial -20 -20|#ffffff 0|#f70000 48|#900000 80|#ab0000 100',
    'logoptshad2' : '=path 0 0|#770000;64 0|#770000;70 78|#770000;0 100'}


# contenu des pages exemples
pagesconf = {'Rectangle' : {'consigne' : {'itemtype' : 'text',
                                          'coords' : (-285, 155),
                                          'params' : {'font' : font_9b,
                                                      'text' : "Mouse button 1 drag objects,\nEscape key reset transfos.",
                                                      'color' : '#2222cc',
                                                      },
                                          },
                            # roudedrectangle simple + radius 20
                            'rr1' : {'itemtype' : 'roundedrectangle',
                                     'coords' : ((-200, 30), (50, 130)),
                                     'radius' : 20,
                                     'params' : {'closed' : 1,
                                                 'filled' : 1,
                                                 'fillcolor' : 'roundrect2',
                                                 'linewidth' : 2,
                                                 'linecolor' : '#000000',
                                                 'priority' : 20,
                                                 'tags' : ('move'),
                                                 },
                                     },
                            # roudedrectangle 'carré' (radius automatique)
                            'rr2' : {'itemtype' : 'roundedrectangle',
                                     'coords' : ((-250, -100), (-90, 60)),
                                     'params' : {'closed' : 1,
                                                 'filled' : 1,
                                                 'fillcolor' : 'roundrect1',
                                                 'linewidth' : 3,
                                                 'linecolor' : '#000000',
                                                 'priority' : 30,
                                                 'tags' : ('move'),
                                                 },
                                     },
                            # cas particulier -> hippodrome (radius = h/2)
                            'rr3' : {'itemtype' : 'roundedrectangle',
                                     'coords' : ((-30, 80), (130, 160)),
                                     'radius' : 40,
                                     'params' : {'closed' : 1,
                                                 'filled' : 1,
                                                 'fillcolor' : 'roundrect3',
                                                 'linewidth' : 4,
                                                 'linecolor' : '#000000',
                                                 'priority' : 30,
                                                 'tags' : ('move'),
                                                 },
                                     },
                            'rr4a' : {'itemtype' : 'roundedrectangle',
                                      'coords' : ((-30, -60), (110, 10)),
                                      'radius' : 40,
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'roundrect3',
                                                  'linewidth' : 3,
                                                  'linecolor' : '#000000',
                                                  'priority' : 30,
                                                  'tags' : ('move'),
                                                  },
                                      'corners' : (1, 0, 1, 0),
                                      },
                            'rr4b' : {'itemtype' : 'roundedrectangle',
                                      'coords' : ((118, -68), (220, -132)),
                                      'radius' : 40,
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'roundrect3',
                                                  'linewidth' : 3,
                                                  'linecolor' : '#000000',
                                                  'priority' : 30,
                                                  'tags' : ('move',),
                                                },
                                      'corners' : (1, 0, 1, 0),
                                      },
                            'rr4c' : {'itemtype' : 'roundedrectangle',
                                      'coords' : ((118, -60), (190, 30)),
                                      'radius' : 40,
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'roundrect3',
                                                  'linewidth' : 3,
                                                  'linecolor' : '#000000',
                                                  'priority' : 30,
                                                  'tags' : ('move',),
                                                  },
                                      'corners' : (0, 1, 0, 1),
                                      },
                            'rr4d' : {'itemtype' : 'roundedrectangle',
                                      'coords' : ((40, -152), (110, -68)),
                                      'radius' : 40,
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'roundrect3',
                                                  'linewidth' : 3,
                                                  'linecolor' : '#000000',
                                                  'priority' : 30,
                                                  'tags' : ('move'),
                                                  },
                                      'corners' : (0, 1, 0, 1),
                                      },
                            'gr8' : {'itemtype' : 'group',
                                     'coords' : (0, 0),
                                     'params' : {'priority' : 10,
                                                 'tags' : ('move'),
                                                 'atomic' : 1,
                                                 },
                                     'items' : {'edge' : {'itemtype' : 'roundedrectangle',
                                                          'coords' : ((174, -36), (266, 146)),
                                                          'radius' : 26,
                                                          'params' : {'closed' : 1,
                                                                      'filled' : 1,
                                                                      'fillcolor' : 'roundrect4ed',
                                                                      'linewidth' : 1,
                                                                      'linecolor' : '#ffffff',
                                                                      'priority' : 20,
                                                                      },
                                                          },
                                                'top' : {'itemtype' : 'roundedrectangle',
                                                         'coords' : ((180, -30), (260, 53)),
                                                         'parentgroup' : 'gr8',
                                                         'radius' : 20,
                                                         'params' : {'closed' : 1,
                                                                     'filled' : 1,
                                                                     'fillcolor' : 'roundrect4',
                                                                     'linewidth' : 2.5,
                                                                     'linecolor' : '#000000',
                                                                     'priority' : 30,
                                                                     },
                                                         'corners' : (1, 0, 0, 1),
                                                         },
                                                'topico' : {'itemtype' : 'curve',
                                                            'parentgroup' : 'gr8',
                                                            'coords' : ((220, -10), (200, 30),(240, 30)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : '#ffff00;80',
                                                                        'linewidth' : 1,
                                                                        'linecolor' : '#007900;80',
                                                                        'priority' : 50,
                                                                        },
                                                            },
                                                'bottom' : {'itemtype' : 'roundedrectangle',
                                                            'parentgroup' : 'gr8',
                                                            'coords' : ((180, 57), (260, 140)),
                                                            'radius' : 20,
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'roundrect4',
                                                                        'linewidth' : 2.5,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 30,
                                                                        },
                                                            'corners' : (0, 1, 1, 0),
                                                            },
                                                'bottomico' : {'itemtype' : 'curve',
                                                               'parentgroup' : 'gr8',
                                                               'coords' : ((220, 120),(240, 80),(200, 80)),
                                                               'params' : {'closed' : 1,
                                                                           'filled' : 1,
                                                                           'fillcolor' : '#ffff00;80',
                                                                           'linewidth' : 1,
                                                                           'linecolor' : '#007900;80',
                                                                           'priority' : 50,
                                                                           },
                                                               },
                                                },
                                     },
                            },
             'Hippodrome' : {'consigne' : {'itemtype' : 'text',
                                           'coords' : (-285, 165),
                                           'params' : {'font' : font_9b,
                                                       'text' : "Click hippo Buttons with mouse button 1.\n",
                                                       'color' : '#2222cc',
                                                       },
                                           },
                             'hp1' : {'itemtype' : 'group',
                                      'coords' : (-163, -40),
                                      'params' : {'priority' : 40,
                                                  },
                                      'items' : {'edge' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-46, -86), (46, 86)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'pushbtn_edge',
                                                                       'linewidth' : 1,
                                                                       'linecolor' : '#ffffff',
                                                                       'priority' : 10,
                                                                       },
                                                           },
                                                 'form' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-40, -80), (40, 80)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'pushbtn1',
                                                                       'linewidth' : 3,
                                                                       'linecolor' : '#000000',
                                                                       'priority' : 20,
                                                                       'tags' : ('b1','pushbtn'),
                                                                       },
                                                           },
                                                 },
                                      },
                             'hp2' : {'itemtype' : 'group',
                                      'coords' : (-40, -40),
                                      'params' : {'priority' : 40,
                                                  },
                                      'items' : {'edge' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-46, -86), (46, 86)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'pushbtn_edge',
                                                                       'linewidth' : 1,
                                                                       'linecolor' : '#ffffff',
                                                                       'priority' : 10,
                                                                       },
                                                           },
                                                 'formT' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-40, -80), (40, -28)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'pushbtn1',
                                                                        'linewidth' : 3,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 20,
                                                                        'tags' : ('b2t','pushbtn'),
                                                                        },
                                                            'orientation' : 'vertical',
                                                            'trunc' : 'bottom',
                                                            },
                                                 'formC' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-40, -26.5), (40, 26.5)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'pushbtn1',
                                                                        'linewidth' : 3,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 20,
                                                                        'tags' : ('b2c','pushbtn'),
                                                                        },
                                                            'trunc' : 'both',
                                                            },
                                                 'formB' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-40, 28), (40, 80)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'pushbtn1',
                                                                        'linewidth' : 3,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 20,
                                                                        'tags' : ('b2b','pushbtn'),
                                                                        },
                                                            'orientation' : 'vertical',
                                                            'trunc' : 'top',
                                                            },
                                                 },
                                      },
                             'hp3edge' : {'itemtype' : 'hippodrome',
                                          'coords' : ((-204, 96), (204, 144)),
                                          'params' : {'closed' : 1,
                                                      'filled' : 1,
                                                      'fillcolor' : 'pushbtn_edge2',
                                                      'linewidth' : 1,
                                                      'linecolor' : '#ffffff',
                                                      'priority' : 10,
                                                      },
                                          },
                             'hp3g' : {'itemtype' : 'group',
                                       'coords' : (-160, 120),
                                       'params' : {'priority' : 40,
                                                   },
                                       'items' : {'form' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-40, -20), (40, 20)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'pushbtn2',
                                                                        'linewidth' : 2,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 20,
                                                                        'tags' : ('b3g', 'pushbtn'),
                                                                        },
                                                            'trunc' : 'right',
                                                            },
                                                  'ico' : {'itemtype' : 'curve',
                                                           'coords' : ((-20, 0), (-4, 8), (-4, -8)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : '#000000',
                                                                       'linewidth' : 1,
                                                                       'linecolor' : '#aaaaaa',
                                                                       'relief' : 'raised',
                                                                       'priority' : 30,
                                                                       'tags' : ('b3g', 'pushbtn', 'ico'),
                                                                       },
                                                           'contours' :  [['add',-1,((0, 0),(16, 8),(16, -8))]]
                                                           },
                                                  },
                                       },
                             'hp3c1' : {'itemtype' : 'group',
                                        'coords' : (-80, 120),
                                        'params' : {'priority' : 40,
                                                    },
                                        'items' : {'form' : {'itemtype' : 'hippodrome',
                                                             'coords' : ((-38, -20), (39, 20)),
                                                             'params' : {'closed' : 1,
                                                                         'filled' : 1,
                                                                         'fillcolor' : 'pushbtn2',
                                                                         'linewidth' : 2,
                                                                         'linecolor' : '#000000',
                                                                         'priority' : 20,
                                                                         'tags' : ('b3c1', 'pushbtn'),
                                                                         },
                                                             'trunc' : 'both',
                                                             },
                                                   'ico' : {'itemtype' : 'curve',
                                                            'coords' : ((-8, 0), (8, 8), (8, -8)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : '#000000',
                                                                        'linewidth' : 1,
                                                                        'linecolor' : '#aaaaaa',
                                                                        'priority' : 30,
                                                                        'relief' : 'raised',
                                                                        'tags' : ('b3c1','pushbtn','ico'),
                                                                        },
                                                            },
                                                   },
                                        },
                             'hp3c2' : {'itemtype' : 'group',
                                        'coords' : (0, 120),
                                        'params' : {'priority' : 40,
                                                    },
                                        'items' : {'form' : {'itemtype' : 'hippodrome',
                                                             'coords' : ((-39, -20), (39, 20)),
                                                             'params' : {'closed' : 1,
                                                                         'filled' : 1,
                                                                         'fillcolor' : 'pushbtn2',
                                                                         'linewidth' : 2,
                                                                         'linecolor' : '#000000',
                                                                         'priority' : 20,
                                                                         'tags' : ('b3c2', 'pushbtn'),
                                                                         },
                                                                'trunc' : 'both',
                                                             },
                                                   'ico' : {'itemtype' : 'rectangle',
                                                            'coords' : ((-6, -6), (6, 6)),
                                                            'params' : {'filled' : 1,
                                                                        'fillcolor' : '#000000',
                                                                        'linewidth' : 1,
                                                                        'linecolor' : '#aaaaaa',
                                                                        'priority' : 30,
                                                                        'tags' : ('b3c2', 'pushbtn', 'ico'),
                                                                        },
                                                            },
                                                   },
                                        },
                             'hp3C3' : {'itemtype' : 'group',
                                        'coords' : (80, 120),
                                        'params' : {'priority' : 40,
                                                    },
                                        'items' : {'form' : {'itemtype' : 'hippodrome',
                                                             'coords' : ((-39, -20), (39, 20)),
                                                             'params' : {'closed' : 1,
                                                                         'filled' : 1,
                                                                         'fillcolor' : 'pushbtn2',
                                                                         'linewidth' : 2,
                                                                         'linecolor' : '#000000',
                                                                         'priority' : 20,
                                                                         'tags' : ('b3c3', 'pushbtn'),
                                                                         },
                                                             'trunc' : 'both',
                                                             },
                                                   'ico' : {'itemtype' : 'curve',
                                                            'coords' : ((8, 0), (-8, -8), (-8, 8)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : '#000000',
                                                                        'linewidth' : 1,
                                                                        'linecolor' : '#aaaaaa',
                                                                        'priority' : 30,
                                                                        'relief' : 'raised',
                                                                        'tags' : ('b3c3', 'pushbtn', 'ico'),
                                                                        },
                                                            },
                                                   },
                                        },
                             
                            'hp3D' : {'itemtype' : 'group',
                                      'coords' : (160, 120),
                                      'params' : {'priority' : 40,
                                                  },
                                      'items' : {'form' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-40, -20), (40, 20)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'pushbtn2',
                                                                       'linewidth' : 2,
                                                                       'linecolor' : '#000000',
                                                                       'priority' : 20,
                                                                       'tags' : ('b3d', 'pushbtn'),
                                                                       },
                                                           'trunc' : 'left',
                                                           },
                                                 'ico' : {'itemtype' : 'curve',
                                                          'coords' : ((20, 0), (4, -8), (4, 8)),
                                                          'params' : {'closed' : 1,
                                                                      'filled' : 1,
                                                                      'fillcolor' : '#000000',
                                                                      'linewidth' : 1,
                                                                      'linecolor' : '#aaaaaa',
                                                                      'priority' : 30,
                                                                      'relief' : 'raised',
                                                                      'tags' : ('b3d', 'pushbtn', 'ico'),
                                                                      },
                                                          'contours' :  [['add', -1, ((0,0), (-16, -8), (-16, 8))]],
                                                          },
                                                 },
                                      },
                             
                             'hp4a' : {'itemtype' : 'group',
                                       'coords' : (48, -97),
                                       'params' : {'priority' : 40,
                                                   },
                                       'repeat' : {'num' : 2,
                                                   'dxy' : (0, 64),
                                                   },
                                       'items' : {'edge' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-29, -29), (29, 29)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'pushbtn_edge',
                                                                        'linewidth' : 1,
                                                                        'linecolor' : '#ffffff',
                                                                        'priority' : 0,
                                                                        },
                                                            },
                                                  'form' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-24, -24), (24, 24)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'pushbtn3',
                                                                        'linewidth' : 3,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 30,
                                                                        'tags' : ('b4a','pushbtn'),
                                                                        },
                                                            },
                                                  },
                                       },
                             
                             'hp4b' : {'itemtype' : 'group',
                                       'coords' : (145, -65),
                                       'params' : {'priority' : 40,
                                                   },
                                       'items' : {'edge' : {'itemtype' : 'hippodrome',
                                                            'coords' : ((-60, -60), (60, 60)),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'conical_edge',
                                                                        'linewidth' : 1,
                                                                        'linecolor' : '#ffffff',
                                                                        'priority' : 0,
                                                                        },
                                                            },
                                                  'ext' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-53, -53), (53, 53)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'conical_ext',
                                                                       'linewidth' : 3,
                                                                       'linecolor' : '#000000',
                                                                       'priority' : 10,
                                                                       'tags' : ('b4b','pushbtn'),
                                                                       },
                                                           },
                                                  'int' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-41, -41), (40, 40)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : '=path 10 10|#ffffff 0|#ccccd0 50|#99999f 80|#99999f;0 100',
                                                                       'linewidth' : 0,
                                                                       'linecolor' : '#cccccc;80',
                                                                       'priority' : 30,
                                                                       'tags' : ('b4b','pushbtn'),
                                                                       },
                                                           },
                                                  },
                                       },
                             
                             'hp5' : {'itemtype' : 'group',
                                      'coords' : (60, 25),
                                      'params' : {'priority' : 40,
                                                  },
                                      'rotate' : 30,
                                      'repeat' : {'num' : 4,
                                                  'dxy' : (45, 0),
                                                  },
                                      'items' : {'edge' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-19, -34), (19, 34)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'pushbtn_edge',
                                                                       'linewidth' : 1,
                                                                       'linecolor' : '#ffffff',
                                                                       'priority' : 10,
                                                                       },
                                                           },
                                                 'form' : {'itemtype' : 'hippodrome',
                                                           'coords' : ((-15, -30), (15, 30)),
                                                           'params' : {'closed' : 1,
                                                                       'filled' : 1,
                                                                       'fillcolor' : 'pushbtn1',
                                                                       'linewidth' : 2,
                                                                       'linecolor' : '#000000',
                                                                       'priority' : 20,
                                                                       'tags' : ('b5', 'pushbtn'),
                                                                       },
                                                           },
                                                 },
                                      },
                             },

             'Polygone' : {'consigne' : {'itemtype' : 'text',
                                         'coords' : (-285, 160),
                                         'params' : {'font' : font_9b,
                                                     'text' : "Click and Drag inside Polygons for rotate them\nEscape key reset transfos.",
                                                     'color' : '#2222cc',
                                                     },
                                         },
                           'triangle' : {'itemtype' : 'group',
                                         'coords' : (-215, -95),
                                         'items' : {'form' : {'itemtype' : 'polygone',
                                                              'coords' : (0, 0),
                                                              'numsides' : 3,
                                                              'radius' : 78,
                                                              'corner_radius' : 10,
                                                              'startangle' : 90,
                                                              'params' : {'closed' : 1,
                                                                          'filled' : 1,
                                                                          'fillcolor' : 'roundpolyg',
                                                                          'linewidth' : 2,
                                                                          'linecolor' : '#330000',
                                                                          'priority' : 20,
                                                                          'tags' : ('p1', 'poly'),
                                                                          },
                                                              },
                                                    'text' : {'itemtype' : 'text',
                                                              'coords' : (0, -6),
                                                              'params' : {'font' : font_9b,
                                                                          'text' : "Triangle",
                                                                          'anchor' : 'n',
                                                                          'alignment' : 'center',
                                                                          'color' : '#660000',
                                                                          'priority' : 50,
                                                                          },
                                                              },
                                                    },
                                         },
                           
				 'carre' : {'itemtype' : 'group',
                                            'coords' : (-80, -75),
                                            'items' : {'form' : {'itemtype' : 'polygone',
                                                                 'coords' : (0, 0),
                                                                 'numsides' : 4,
                                                                 'radius' : 70,
                                                                 'corner_radius' : 10,
                                                                 'startangle' : 90,
                                                                 'params' : {'closed' : 1,
                                                                             'filled' : 1,
                                                                             'fillcolor' : 'roundpolyg',
                                                                             'linewidth' : 2,
                                                                             'linecolor' : '#330000',
                                                                             'priority' : 20,
                                                                             'tags' : ('p2', 'poly'),
                                                                             },
                                                                 },
                                                       'text' : {'itemtype' : 'text',
                                                                 'coords' : (0, -6),
                                                                 'params' : {'font' : font_9b,
                                                                             'text' : "Carré",
                                                                             'anchor' : 'n',
                                                                             'alignment' : 'center',
                                                                             'color' : '#660000',
                                                                             'priority' : 50,
                                                                             },
                                                                 },
						       },
					    },
                           
                           'pentagone' : {'itemtype' : 'group',
                                          'coords' : (65, -75),
                                          'items' : {'form' : {'itemtype' : 'polygone',
                                                               'coords' : (0, 0),
                                                               'numsides' : 5,
                                                               'radius' : 70,
                                                               'corner_radius' : 10,
                                                               'startangle' : 270,
                                                               'params' : {'closed' : 1,
                                                                           'filled' : 1,
                                                                           'fillcolor' : 'roundpolyg',
                                                                           'linewidth' : 2,
                                                                           'linecolor' : '#330000',
                                                                           'priority' : 20,
                                                                           'tags' : ('p3', 'poly'),
                                                                           },
                                                               },
                                                     'text' : {'itemtype' : 'text',
                                                               'coords' : (0, -6),
                                                               'params' : {'font' : font_9b,
                                                                           'text' : "Pentagone",
                                                                           'anchor' : 'n',
                                                                           'alignment' : 'center',
                                                                           'color' : '#660000',
                                                                           'priority' : 50,
                                                                           },
                                                               },
                                                     },
                                          },
                           
                           'hexagone' : {'itemtype' : 'group',
                                         'coords' : (210, -75),
                                         'items' : {'form' : {'itemtype' : 'polygone',
                                                              'coords' : (0, 0),
                                                              'numsides' : 6,
                                                              'radius' : 68,
                                                              'corner_radius' : 10,
                                                              'params' : {'closed' : 1,
                                                                          'filled' : 1,
                                                                          'fillcolor' : 'roundpolyg',
                                                                          'linewidth' : 2,
                                                                          'linecolor' : '#330000',
                                                                          'priority' : 20,
                                                                          'tags' : ('p4', 'poly'),
                                                                          },
                                                              },
                                                    'text' : {'itemtype' : 'text',
                                                              'coords' : (0, -6),
                                                              'params' : {'font' : font_9b,
                                                                          'text' : "Hexagone",
                                                                          'anchor' : 'n',
                                                                          'alignment' : 'center',
                                                                          'color' : '#660000',
                                                                          'priority' : 50,
                                                                          },
                                                              },
                                                    },
                                         },

                           'heptagone' : {'itemtype' : 'group',
                                          'coords' : (-215, 85),
                                          'items' : {'form' : {'itemtype' : 'polygone',
                                                               'coords' : (0, 0),
                                                               'numsides' : 7,
                                                               'radius' : 64,
                                                               'corner_radius' : 10,
                                                               'params' : {'closed' : 1,
                                                                           'filled' : 1,
                                                                           'fillcolor' : 'roundpolyg',
                                                                           'linewidth' : 2,
                                                                           'linecolor' : '#330000',
                                                                           'priority' : 20,
                                                                           'tags' : ('p5', 'poly'),
                                                                           },
                                                                },
                                                     'text' : {'itemtype' : 'text',
                                                               'coords' : (0, -6),
                                                               'params' : {'font' : font_9b,
                                                                           'text' : "Heptagone",
                                                                           'anchor' : 'n',
                                                                           'alignment' : 'center',
                                                                           'color' : '#660000',
                                                                           'priority' : 50,
                                                                           },
                                                               },
                                                     },
                                          },
                           

                           'octogone' : {'itemtype' : 'group',
                                         'coords' : (-76, 85),
                                         'items' : {'form' : {'itemtype' : 'polygone',
                                                              'coords' : (0, 0),
                                                              'numsides' : 8,
                                                              'radius' : 64,
                                                              'corner_radius' : 10,
                                                              'params' : {'closed' : 1,
                                                                          'filled' : 1,
                                                                          'fillcolor' : 'roundpolyg',
                                                                          'linewidth' : 2,
                                                                          'linecolor' : '#330000',
                                                                          'priority' : 20,
                                                                          'tags' : ('p6', 'poly'),
                                                                        },
                                                              },
                                                    'text' : {'itemtype' : 'text',
                                                              'coords' : (0, -6),
                                                              'params' : {'font' : font_9b,
                                                                          'text' : "Octogone",
                                                                          'anchor' : 'n',
                                                                          'alignment' : 'center',
                                                                          'color' : '#660000',
                                                                          'priority' : 50,
                                                                          },
                                                              },
                                                    },
                                         },
                           
                           'petagone' : {'itemtype' : 'group',
                                         'coords' : (66, 85),
                                         'items' : {'form' : {'itemtype' : 'polygone',
                                                              'coords' : (0, 0),
                                                              'numsides' : 32,
                                                              'radius' : 64,
                                                              'corner_radius' : 10,
                                                              'params' : {'closed' : 1,
                                                                          'filled' : 1,
                                                                          'fillcolor' : 'roundpolyg',
                                                                          'linewidth' : 2,
                                                                          'linecolor' : '#330000',
                                                                          'priority' : 20,
                                                                          'tags' : ('p7', 'poly'),
                                                                          },
                                                              },
                                                    'text' : {'itemtype' : 'text',
                                                              'coords' : (0, -6),
                                                              'params' : {'font' : font_9b,
                                                                          'text' : "32 cotés...",
                                                                          'anchor' : 'n',
                                                                          'alignment' : 'center',
                                                                          'color' : '#660000',
                                                                          'priority' : 50,
                                                                          },
                                                              },
                                                    },
                                         },

                           'etoile' : {'itemtype' : 'group',
                                       'coords' : (210, 85),
                                       'items' : {'form' : {'itemtype' : 'polygone',
                                                            'coords' : (0, 0),
                                                            'numsides' : 5,
                                                            'radius' : 92,
                                                            'inner_radius' : 36,
                                                            'corner_radius' : 10,
                                                            'startangle' : 270,
                                                            'corners' : (0, 1, 0, 1, 0, 1, 0, 1, 0, 1),
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'fillcolor' : 'roundpolyg',
                                                                        'linewidth' : 2,
                                                                        'linecolor' : '#330000',
                                                                        'priority' : 20,
                                                                        'tags' : ('p8', 'poly'),
                                                                        },
                                                            },
                                                  'text' : {'itemtype' : 'text',
                                                            'coords' : (0, -6),
                                                            'params' : {'font' : font_9b,
                                                                        'text' : "Etoile",
                                                                        'anchor' : 'n',
                                                                        'alignment' : 'center',
                                                                        'color' : '#660000',
                                                                        'priority' : 50,
                                                                        },
                                                            },
                                                  },
                                       },
                           },

             'Polyline' : {'consigne' : {'itemtype' : 'text',
                                         'coords' : (-285, 155),
                                         'params' : {'font' : font_9b,
                                                     'text' : "Mouse button 1 drag objects,\nEscape key reset transfos.",
                                                     'color' : '#2222cc',
                                                     },
                                         },
                           'a' : {'itemtype' : 'polyline',
                                  'coords' : ((-200, -115), (-200, -100), (-218, -115), (-280, -115), (-280, -16),
                                              (-218, -16), (-200, -31), (-200, -17.5), (-150, -17.5), (-150,-115)),
                                  'corners_radius' : (0, 0, 42, 47, 47, 42, 0, 0, 0, 0, 0, 0),
                                  'params' : {'closed' : 1,
                                              'filled' : 1,
                                              'visible' : 1,
                                              'fillcolor' : 'rpolyline',
                                              'linewidth' : 2,
                                              'linecolor' : '#000000',
                                              'priority' : 50,
                                              'tags' : ('move'),
                                              },
                                  'contours' : [['add', -1, ((-230, -80), (-230, -50), (-200, -50), (-200, -80)),15]],
                                  },
                           'b' : {'itemtype' : 'polyline',
                                  'coords' : ((-138, -150), (-138, -17.5), (-88, -17.5), (-88, -31), (-70, -16),
                                              (-8, -16), (-8, -115), (-70, -115), (-88, -100), (-88, -150)),
                                  'corners_radius' : (0, 0, 0, 0, 42, 47, 47, 42, 0, 0, 0, 0, 0, 0),
                                  'params' : {'closed' : 1,
                                              'filled' : 1,
                                              'visible' : 1,
                                              'fillcolor' : 'rpolyline',
                                              'linewidth' : 2,
                                              'linecolor' : '#000000',
                                              'priority' : 50,
                                              'tags' : ('move'),
                                              },
                                  'contours' : [['add', -1, ((-88, -80), (-88, -50), (-58, -50), (-58, -80)), 15]],
                                  },
                           'c' : {'itemtype' : 'polyline',
                                  'coords' : ((80, -76), (80, -110), (60, -115), (0, -115), (0, -16),
                                              (60, -16), (80, -21), (80, -57), (50, -47), (50, -86)),
                                  'corners_radius' : (0, 0, 70, 47, 47, 70, 0, 0, 14, 14, 0, 0, 0,0 ),
                                  'params' : {'closed' : 1,
                                              'filled' : 1,
                                              'visible' : 1,
                                              'fillcolor' : 'rpolyline',
                                              'linewidth' : 2,
                                              'linecolor' : '#000000',
                                              'priority' : 50,
                                              'tags' : ('move'),
                                              },
                                  },
                           'spirale' : {'itemtype' : 'polyline',
                                        'coords' : ((215, -144), (139, -144), (139, 0), (268, 0), (268, -116),
                                                    (162.5, -116), (162.5, -21), (248, -21), (248, -96), (183, -96),
                                                    (183, -40), (231,-40), (231, -80), (199, -80), (199, -55), (215, -55)),
                                        'corners_radius' : (0, 76, 68, 61, 55, 50, 45, 40, 35, 30, 26, 22, 18, 14, 11),
                                        'params' : {'closed' : 1,
                                                    'filled' : 1,
                                                    'visible' : 1,
                                                    'fillcolor' : 'rpolyline',
                                                    'linewidth' : 2,
                                                    'linecolor' : '#000000',
                                                    'priority' : 50,
                                                    'tags' : ('move'),
                                                    },
                                        },
                           'logo' : {'itemtype' : 'group',
                                     'coords' : (0, 0),
                                     'params' : {'priority' : 30,
                                                 'atomic' : 1,
                                                 'tags' : ('move'),
                                                 },
                                     'items' : {'tkzinc' : {'itemtype' : 'polyline',
                                                            'coords' : ((-150,10), (-44,10), (-44,68), (-28,51), (6,51),
                                                                        (-19,79), (3,109), (53,51), (5,51), (5,10), (140,10),
                                                                        (52,115), (96,115), (96,47), (196,47), (196,158),
                                                                        (155,158), (155,89), (139,89), (139,160), (101, 160),
                                                                        (101,132), (85,132), (85,160), (-42,160), (-2,115),
                                                                        (-30,115), (-46,91), (-46,115), (-76,115), (-76,51),
                                                                        (-98,51), (-98,115), (-130,115), (-130,51), (-150, 51)),
                                                            'corners_radius' : [0,0,0,0,0,0,0,0,0,0,30,0,0,50,50,
                                                                                0,0,8,8,0,0,8,8,0,27],
                                                            'params' : {'closed' : 1,
                                                                        'filled' : 1,
                                                                        'visible' : 1,
                                                                        'fillcolor' : 'logoshape2',
                                                                        'linewidth' : 2.5,
                                                                        'linecolor' : '#000000',
                                                                        'priority' : 10,
                                                                        'fillrule' : 'nonzero',
                                                                        },
                                                            
                                                            'contours' : [['add', 1, ((245,88), (245,47), (190,47), (190,158),
                                                                                      (259,158), (259,117), (230,117), (230,88)),
                                                                           5, None, (0,0,55,55,0,0,15,15)]],
                                                            },
                                                'shad' : {'itemtype' : 'arc',
                                                          'coords' : ((75, 91), (115,131)),
                                                          'params' : {'priority' : 20,
                                                                      'filled' : 1,
                                                                      'linewidth' : 0,
                                                                      'fillcolor' : 'logoptshad2',
                                                                      'closed' : 1,
                                                                      },
                                                          },
                                                'point' : {'itemtype' : 'arc',
                                                           'coords' : ((70, 86), (110,126)),
                                                           'params' : {'priority' : 50,
                                                                       'filled' : 1,
                                                                       'linewidth' : 1,
                                                                       'linecolor' : '#a10000',
                                                                       'fillcolor' : 'logopoint2',
                                                                       'closed' : 1,
                                                                       },
                                                           },
                                                },
                                     },
                           },
             
             'MultiContours' : {'consigne' : {'itemtype' : 'text',
                                              'coords' : (-285, 155),
                                              'params' : {'font' : font_9b,
                                                          'text' : "Mouse button 1 drag objects,\nEscape key reset transfos.",
                                                          'color' : '#2222cc',
                                                          },
					      },
                                'mc1' : {'itemtype' : 'roundedcurve',
                                         'coords' : ((-30, -170), (-130, 0), (70, 0)),
                                         'radius' : 14,
                                         'params' : {'closed' : 1,
                                                     'filled' : 1,
                                                     'fillcolor' : 'roundcurve2',
                                                     'linewidth' : 1,
                                                     'linecolor' : '#000000',
                                                     'priority' : 20,
                                                     'tags' : ('move'),
                                                     'fillrule' : 'odd',
                                                     },
                                         'contours' : [['add', 1,((-30,-138), (-100,-18), (40,-18)), 8],
                                                       ['add', 1,((-30,-130), ( -92,-22), (32,-22)), 5],
                                                       ['add', 1,((-30,-100), ( -68,-36), (8,-36)), 5],
                                                       ['add', 1,((-30, -92), ( -60,-40), (0,-40)), 3],],
                                         },
                                'mc2' : {'itemtype' : 'polyline',
                                         'coords' : ((-250,-80), (-240,-10), (-285,-10), (-285,80),
                                                     (-250, 80), (-250, 40), (-170, 40), (-170,80),
                                                     (-100,80), (-100,40), (-20,40), (-20,80), (30,80),
                                                     (-10, 0), (-74, -10), (-110, -80)),
                                         'corners_radius' : (24,4, 40, 20, 0, 40, 40, 0, 0, 40, 40, 0, 30, 75, 0, 104),
                                         'params' : {'closed' : 1,
                                                     'filled' : 1,
                                                     'fillcolor' : 'roundcurve1',
                                                     'linewidth' : 2,
                                                     'linecolor' : '#000000',
                                                     'priority' : 30,
                                                     'tags' : ('move'),
                                                     },
                                         'contours' : [['add',-1,((-240,-72), (-230,0), (-169,0), (-185, -72)),
                                                        0, None, (16, 16, 0, 0)],
                                                       ['add', -1, ((-175,-72), (-159,0), (-78,0), (-116, -72)),
                                                        0, None, (0, 0, 8, 88)],
                                                       ['add', 1, ((-245,45), (-245,115), (-175,115), (-175, 45)),
                                                        35],
                                                       ['add', -1, ((-225,65), (-225,95), (-195,95), (-195, 65)),
                                                        15],
                                                       ['add', 1, ((-95,45), (-95,115), (-25,115), (-25, 45)),
                                                        35],
                                                       ['add', -1, ((-75,65), (-75,95), (-45,95), (-45, 65)),
                                                        15],
                                                       ],
                                         },
                                'mc3' : {'itemtype' : 'roundedcurve',
                                         'coords' : ((-10, 170), (256, 170), (312, 60), (48, 60)),
                                         'radius' : 34,
                                         'params' : {'closed' : 1,
                                                     'filled' : 1,
                                                     'fillcolor' : 'roundcurve2',
                                                     'linewidth' : 2.5,
                                                     'linecolor' : '#000000',
                                                     'priority' : 40,
                                                     'tags' : ('move'),
                                                     },
                                         'contours' : [['add', -1, ((58, 62), (12, 144), (60, 172), (104, 88)), 27],
                                                       ['add', 1, ((48, 77), (48, 119), (90, 119), (90, 77)), 21],
                                                       ['add', -1, ((244, 58), (198, 140), (246, 168), (290, 84)), 27],
                                                       ['add', 1, ((213, 110), (213, 152), (255, 152), (255, 110)), 21],
                                                       ['add', -1, ((150, 60), (150, 170), (160, 170), (160, 60)), 0]],
                                         },
                                'mc4' : {'itemtype' : 'roundedcurve',
                                         'coords' : ((222, -150), (138, -150), (180, -50), (138, -150),
                                                     (80, -92), (180, -50), (80, -92), (80, -8),
                                                     (180, -50), (80, -8), (138, 50), (180, -50),
                                                     (138, 50), (222, 50), (179.8, -50), (222, 50),
                                                     (280, -8), (180, -50), (280, -8), (280, -92),
                                                     (180, -50), (280, -92), (222,-150), (180,-50)),
                                         'radius' : 28,
                                         'params' : {'closed' : 1,
                                                     'filled' : 1,
                                                     'fillcolor' : 'roundcurve',
                                                     'linewidth' : 2,
                                                     'linecolor' : '#000000',
                                                     'priority' : 30,
                                                     'tags' : ('move'),
                                                     },
                                         'contours' : [['add', -1, ((160, -70), (160, -30), (200, -30), (200, -70)), 20]],
                                         },
                                },
             
             'TabBox' : {'consigne' : {'itemtype' : 'text',
                                       'coords' : (-285, 160),
                                       'params' : {'font' : font_9b,
                                                   'text' : "Click on thumbnail to select page\nChange anchor or alignment tabs options with radio buttons.\n",
                                                   'color' : '#2222cc',
                                                   },
                                       },
                         
                         'exemple' : {'itemtype' : 'text',
                                      'coords' : (-165, -105),
                                      'params' : {'font' : font_9b,
                                                  'text' : "",
                                                  'alignment' : 'left',
                                                  'anchor' : 'nw',
                                                  'color' : '#000000',
                                                  'priority' : 500,
                                                  'width' : 350,
                                                  'tags' : ('div2', 'fontname'),
                                                  },
                                      },
                         
                         'bo1' : {'itemtype' : 'tabbox',
                                  'coords' : ((-240, -160), (240, 100)),
                                  'radius' : 8,
                                  'tabwidth' : 72,
                                  'tabheight' : 28,
                                  'numpages' : 8,
                                  'anchor' : 'n',
                                  'alignment' : 'left',
                                  'overlap' : 3,
                                  'params' : {'closed' : 1,
                                              'priority' : 100,
                                              'filled' : 1,
                                              'fillcolor' : '#ffffff',
                                              'linewidth' : 1.2,
                                              'linecolor' : '#000000',
                                              'tags' : ('div2', 'divider'),
                                              },
                                  'tabtitles' : {'text' : ('A', 'B', 'C', 'D', 'E', 'F','G','H'),
                                                 'params' : {'text' : 'titre',
                                                             'color' : '#2222cc',
                                                             'font' : font_9b,
                                                             'anchor' : 'center',
                                                             'alignment' : 'center',
                                                             'priority' : 400,
                                                             'visible' : 1,
                                                             },
                                                 },
                                  },
                         
                         'back' : {'itemtype' : 'roundedrectangle',
                                   'coords' : ((-242, -162), (242, 102)),
                                   'radius' : 10,
                                   'params' : {'closed' : 1,
                                               'filled' : 1,
                                               'fillcolor' : '#777777;80',
                                               'linewidth' : 1,
                                               'linecolor' : '#777777;80',
                                               },
                                   },
                         
                         'anchor' : {'itemtype' : 'text',
                                     'coords' : (-120, 115),
                                     'params' : {'text' : 'tabs anchor',
                                                 'color' : '#2222cc',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 },
                                     },
                         
                         'anchorN' : {'itemtype' : 'hippodrome',
                                      'coords' : ((-210, 125), (-165, 151)),
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'pushbtn4',
                                                  'linewidth' : 1.5,
                                                  'linecolor' : '#000000',
                                                  'priority' : 20,
                                                  'tags' : ('sel1', 'n', 'btn', 'selector'),
                                                  },
                                      'trunc' : 'right',
                                      },
                         'txtanN' : {'itemtype' : 'text',
                                     'coords' : (-187, 138),
                                     'params' : {'text' : 'N',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel1', 'n', 'btntext', 'selector'),
                                                 },
                                     },

                         'anchorE' : {'itemtype' : 'hippodrome',
                                      'coords' : ((-163, 125), (-120, 151)),
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'pushbtn4',
                                                  'linewidth' : 1.5,
                                                  'linecolor' : '#000000',
                                                  'priority' : 20,
                                                  'tags' : ('sel1', 'e', 'btn', 'selector'),
							},
                                      'trunc' : 'both',
                                    },
                         'txtanE' : {'itemtype' : 'text',
                                     'coords' : (-141.5, 138),
                                     'params' : {'text' : 'E',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel1', 'e', 'btntext', 'selector'),
                                                },
                                     },

                         'anchorS' : {'itemtype' : 'hippodrome',
                                      'coords' : ((-118, 125), (-75, 151)),
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'pushbtn4',
                                                  'linewidth' : 1.5,
                                                  'linecolor' : '#000000',
                                                  'priority' : 20,
                                                  'tags' : ('sel1', 's', 'btn', 'selector'),
                                                  },
                                      'trunc' : 'both',
                                      },
                         'txtanS' : {'itemtype' : 'text',
                                     'coords' : (-96.5, 138),
                                     'params' : {'text' : 'S',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel1', 's', 'btntext', 'selector'),
                                                 },
                                     },
                         'anchorW' : {'itemtype' : 'hippodrome',
                                      'coords' : ((-73, 125), (-28, 151)),
                                      'params' : {'closed' : 1,
                                                  'filled' : 1,
                                                  'fillcolor' : 'pushbtn4',
                                                  'linewidth' : 1.5,
                                                  'linecolor' : '#000000',
                                                  'priority' : 20,
                                                  'tags' : ('sel1', 'w', 'btn', 'selector'),
                                                  },
                                      'trunc' : 'left',
                                      },
                         'txtanW' : {'itemtype' : 'text',
                                     'coords' : (-52, 138),
                                     'params' : {'text' : 'W',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel1', 'w', 'btntext', 'selector'),
                                                 },
                                     },
                         'alignment' : {'itemtype' : 'text',
                                        'coords' : (120, 115),
                                        'params' : {'text' : 'tabs alignment',
                                                    'color' : '#2222cc',
                                                    'font' : font_9b,
                                                    'anchor' : 'center',
                                                    'alignment' : 'center',
                                                    'priority' : 40,
                                                    },
                                        },
                         'alignG' : {'itemtype' : 'hippodrome',
                                     'coords' : ((30, 125), (90, 151)),
                                     'params' : {'closed' : 1,
                                                 'filled' : 1,
                                                 'fillcolor' : 'pushbtn4',
                                                 'linewidth' : 1.5,
                                                 'linecolor' : '#000000',
                                                 'priority' : 20,
                                                'tags' : ('sel2', 'left', 'btn', 'selector'),
                                                 },
                                     'trunc' : 'right',
                                     },
                         'txtalG' : {'itemtype' : 'text',
                                     'coords' : (60, 138),
                                     'params' : {'text' : 'left',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel2', 'left', 'btntext', 'selector'),
                                                 },
                                     },
                         'alignC' : {'itemtype' : 'hippodrome',
                                     'coords' : ((92, 125), (148, 151)),
                                     'params' : {'closed' : 1,
                                                 'filled' : 1,
                                                 'fillcolor' : 'pushbtn4',
                                                 'linewidth' : 1.5,
                                                 'linecolor' : '#000000',
                                                 'priority' : 20,
                                                 'tags' : ('sel2', 'center', 'btn', 'selector'),
                                                 },
                                     'trunc' : 'both',
                                     },
                         'txtalC' : {'itemtype' : 'text',
                                     'coords' : (120, 138),
                                     'params' : {'text' : 'center',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel2', 'center', 'btntext', 'selector'),
                                                 },
                                     },
                         'alignD' : {'itemtype' : 'hippodrome',
                                     'coords' : ((150, 125), (210, 151)),
                                     'params' : {'closed' : 1,
                                                 'filled' : 1,
                                                 'fillcolor' : 'pushbtn4',
                                                 'linewidth' : 1.5,
                                                 'linecolor' : '#000000',
                                                 'priority' : 20,
                                                 'tags' : ('sel2', 'right', 'btn', 'selector'),
                                                 },
                                     'trunc' : 'left',
                                     },
                         'txtalD' : {'itemtype' : 'text',
                                     'coords' : (180, 138),
                                     'params' : {'text' : 'right',
                                                 'color' : '#000000',
                                                 'font' : font_9b,
                                                 'anchor' : 'center',
                                                 'alignment' : 'center',
                                                 'priority' : 40,
                                                 'tags' : ('sel2', 'right', 'btntext', 'selector'),
                                                 },
                                     },
                         },
             
             'PathLine' : {'consigne' : {'itemtype' : 'text',
                                         'coords' : (-285, 155),
                                         'params' : {'font' : font_9b,
                                                     'text' : "Mouse button 1 drag objects,\nEscape key reset transfos.",
                                                     'color' : '#2222cc',
                                                     },
                                         },
                           'pl1' : {'itemtype' : 'pathline',
                                    'metacoords' : {'type' : 'polygone',
                                                     'coords' : (0, 0),
                                                     'numsides' : 12,
                                                     'radius' : 200,
                                                     'inner_radius' : 100,
                                                     'startangle' : -8,
                                                     },
                                    'linewidth' : 20,
                                    'closed' : 1,
                                    'graduate' : {'type' : 'linear',
                                                  'colors' : ('#ff0000', '#ff00ff', '#0000ff', '#00ffff',
                                                              '#00ff00', '#ffff00', '#ff0000'),
                                                  },
                                    'params' : {'priority' : 100,
                                                'tags' : ('move'),
                                                },
                                    },
                           
                           'pl2' : {'itemtype' : 'group',
                                    'coords' : (0, 0),
                                    'params' : {'priority' : 200,
                                                'atomic' : 1,
                                                'tags' : ('move'),
                                                },
                                    'items' : {'in' : {'itemtype' : 'pathline',
                                                       'coords' : ((30, -60), (-30, -60), (-30, -30),
                                                                   (-60, -30), (-60, 30), (-30, 30),
                                                                   (-30, 60), (30, 60), (30, 30),
                                                                   (60, 30), (60, -30), (30, -30)),
                                                       'linewidth' : 16,
                                                       'closed' : 1,
                                                       'shifting' : 'left',
                                                       'graduate' : {'type' : 'transversal',
                                                                     'colors' : ('#00aa77;100', '#00aa77;0'),
                                                                     },
                                                       'params' : {'priority' : 10,
                                                                   },
                                                       },
                                               
                                               'out' : {'itemtype' : 'pathline',
                                                        'coords' : ((30, -60), (-30, -60), (-30, -30),
                                                                    (-60, -30), (-60, 30), (-30, 30),
                                                                    (-30, 60), (30, 60), (30, 30),
                                                                    (60, 30), (60, -30), (30, -30)),
                                                        'linewidth' : 10,
                                                        'closed' : 1,
                                                        'shifting' : 'in',
                                                        'graduate' : {'type' : 'transversal',
                                                                      'colors' : ('#00aa77;100', '#00aa77;0'),
                                                                      },
                                                        'params' : {'priority' : 10,
                                                                    },
                                                        },
                                               },
                                    },
                           
                           'pl3' : {'itemtype' : 'group',
                                    'coords' : (0, 0),
                                    'params' : {'priority' : 100,
                                                'atomic' : 1,
                                                'tags' : ('move'),
                                                },
                                    'items' : {'back' : {'itemtype' : 'arc',
                                                         'coords' : ((-150, -150), (150,150)),
                                                         'params' : {'priority' : 10,
                                                                     'closed' : 1,
                                                                     'filled' : 1,
                                                                     'fillcolor' : '=radial 15 15|#ffffff;40|#aaaaff;10',
                                                                     'linewidth' : 0,
                                                                     },
                                                         },
                                               'light' : {'itemtype' : 'pathline',
                                                          'metacoords' : {'type' : 'polygone',
                                                                           'coords' : (0, 0),
                                                                           'numsides' : 30,
                                                                           'radius' : 150,
                                                                           'startangle' : 240,
                                                                           },
                                                          'linewidth' : 20,
                                                          'shifting' : 'in',
                                                          'closed' : 1,
                                                          'graduate' : {'type' : 'double',
                                                                        'colors' : (('#ffffff;0', '#222299;0', '#ffffff;0'),
                                                                                    ('#ffffff;100', '#222299;70', '#ffffff;100')),
                                                                        },
                                                          'params' : {'priority' : 50,
                                                                      },
                                                          },
                                               'bord' : {'itemtype' : 'arc',
                                                         'coords' : ((-150, -150), (150,150)),
                                                         'params' : {'priority' : 100,
                                                                     'closed' : 1,
                                                                     'filled' : 0,
                                                                     'linewidth' : 2,
                                                                     'linecolor' : '#000033;80'
                                                                     },
                                                         },
                                               
                                               },
                                    },
                           }
             }


tabtables = { 'n' : {'numpages' : 8,
                    'titles' : ('A','B','C','D','E','F','G','H'),
                    'names' : ('ATOMIC GROUP :', 'BIND COMMAND :', 'CURVE ITEMS :', 'DISPLAY LIST :',
                               'EVENTS SENSITIVITY :', 'FIT COMMAND :', 'GROUP ITEMS', 'HASTAG COMMAND'),
                    'texts' : ("It may seem at first that there is a contradiction in this title, but there is not. (...) So groups have a feature, the atomic  attribute, that is used to seal a group so that events cannot propagate past it downward. If an item part of an atomic group is under the pointer, TkZinc will try to trigger bindings associated with the atomic group not with the item under the pointer. This improves greatly the metaphor of an indivisible item.",
                               "This widget command is similar to the Tk bind command except that it operates on TkZinc items instead of widgets. Another difference with the bind command is that only mouse and keyboard related events can be specified (such as Enter, Leave, ButtonPress, ButtonRelease, Motion, KeyPress, KeyRelease). The bind manual page is the most accurate place to look for a definition of sequence and command and for a general understanding of how the binding mecanism works.",
                               "Items of type curve display pathes of line segments and/or cubic bezier connected by their end points. A cubic Bezier is defined by four points. The first and last ones are the extremities of the cubic Bezier. The second and the third ones are control point (i.e. they must have a third ``coordinate'' with the value 'c'). If both control points are identical, one may be omitted. As a consequence, it is an error to have more than two succcessive control points or to start or finish a curve with a control point.",
                               "The items are arranged in a display list for each group. The display list imposes a total ordering among its items. The group display lists are connected in a tree identical to the group tree and form a hierarchical display list. The items are drawn by traversing the display list from the least visible item to the most visible one.The search to find the item that should receive an event is done in the opposite direction. In this way, items are drawn according to their relative stacking order and events are dispatched to the top-most item at a given location.",
                               "An item will catch an event if all the following conditions are satisfied: * the item -sensitive must be set to true (this is the default). * the item must be under the pointer location. * the item must be on top of the display list (at the pointer location). Beware that an other item with its -visible set to false DOES catch event before any underneath items. * the item must not be clipped (at the pointer location) * the item must not belong to an atomic group, since an atomic group catchs the event instead of the item.",
                               "This command fits a sequence of Bezier segments on the curve described by the vertices in coordList and returns a list of lists describing the points and control points for the generated segments. All the points on the fitted segments will be within error  distance from the given curve. coordList should be either a flat list of an even number of coordinates in x, y order or a list of lists of point coordinates X, Y. The returned list can be directly used to create or change a curve item contour.",
                               "Groups are very powerful items. They have no graphics of their own but are used to bundle items together so that they can be manipulated easily as a whole. Groups can modify in several way how items are displayed and how they react to events. They have many uses in TkZinc. The main usages are to bundle items, to interpose a new coordinate system in a hierarchy of items, to compose some specific attributes, to apply a clipping to their children items, to manage display",
                               "This command returns a boolean telling if the item specified by tagOrId has the specified tag. If more than one item is named by tagOrId, then the topmost in display list order is used to return the result. If no items are named by tagOrId, an error is raised.",
				  ),
                    },
             'e' : {'numpages' : 5,
                    'titles' : ('I', 'J', 'K', 'L', 'M'),
                    'names' : ('ITEM IDS', 'JOINSTYLE ATTRIBUTE', 'K :', 'LOWER COMMAND', 'MAP ITEM :'),
                    'texts' : ("Each item is associated with a unique numerical id which is returned by the add  or clone  commands. All commands on items accept those ids as (often first) parameter in order to uniquely identify on which item they should operate. When an id has been allocated to an item, it is never collected even after the item has been destroyed, in a TkZinc session two items cannot have the same id. This property can be quite useful when used in conjonction with tags, which are described below.",
                               "Specifies the form of the joint between the curve segments. This attribute is only applicable if the curve outline relief is flat. The default value is round.",
                               "No TkZinc KeyWord with K initial letter...",
                               "Reorder all the items given by tagOrId so that they will be under the item given by belowThis. If tagOrId name more than one item, their relative order will be preserved. If tagOrId doesn't name an item, an error is raised. If  belowThis name more than one item, the bottom most them is used. If belowThis  doesn't name an item, an error is raised. If belowThis is omitted the items are put at the bottom most position of their respective groups.",
                               "Map items are typically used for displaying maps on a radar display view. Maps are not be sensitive to mouse or keyboard events, but have been designed to efficiently display large set of points, segments, arcs, and simple texts. A map item is associated to a mapinfo. This mapinfo entity can be either initialized with the videomap  command or more generally created and edited with a set of commands described in the The mapinfo related commands  section.",
                               ),
                    },
             's' : {'numpages' : 8,
                    'titles' : ('N', 'O', 'P' ,'Q' ,'R' ,'S' ,'T' ,'U'),
                    'names' : ('NUMPARTS COMMAND :', 'OVERLAP MANAGER :', 'PICKAPERTURE WIDGET OPTION :', 'Q :',
                               'RENDER WIDGET OPTION :', 'SMOOTH COMMAND', 'TAGS :', 'UNDERLINED ATTRIBUTE :'),
                    'texts' : ("This command tells how many fieldId are available for event bindings or for field configuration commands in the item specified by tagOrId. If more than one item is named by tagOrId, the topmost in display list order is used to return the result. If no items are named by tagOrId, an error is raised. This command returns always 0 for items which do not support fields. The command hasfields  may be used to decide whether an item has fields.",
                               "his option accepts an item id. It specifies if the label overlapping avoidance algorithm should be allowed to do its work on the track labels and which group should be considered to look for tracks. The default is to enable the avoidance algorithm in the root group (id 1). To disable the algorithm this option should be set to 0.",
                               "Specifies the size of an area around the pointer that is used to tell if the pointer is inside an item. This is useful to lessen the precision required when picking graphical elements. This value must be a positive integer. It defaults to 1.",
                               "No TkZinc KeyWord with Q initial letter...",
                               "Specifies whether to use or not the openGL rendering. When True, requires the GLX extension to the X server. Must be defined at widget creation time. This option is readonly and can be used to ask if the widget is drawing with the GLX extension or in plain X (to adapt the application code for example). The default value is false.",
                               "This command computes a sequence of Bezier segments that will smooth the polygon described by the vertices in coordList and returns a list of lists describing thr points and control points for the generated segments. coordList should be either a flat list of an even number of coordinates in x, y order, or a list of lists of point coordinates X, Y. The returned list can be used to create or change the contour of a curve item.",
                               "Apart from an id, an item can be associated with as many symbolic names as it may be needed by an application. Those names are called tags and can be any string which does not form a valid id (an integer). However the following characters may not be used to form a tag: . * ! ( ) & | :. Tags exists, and may be used in commands, even if no item are associated with them. In contrast an item id doesn't exist if its item is no longer around and thus it is illegal to use it.",
                               "Item Text attribute. If true, a thin line will be drawn under the text characters. The default value is false.",
                               ),
                    },
             'w' : {'numpages' : 5,
                    'titles' : ('V', 'W', 'X', 'Y', 'Z'),
                    'names' : ('VERTEXAT COMMAND :', 'WAYPOINT ITEM :', 'X11, OpenGL and Windows :', 'Y...', 'ZINC an advanced scriptable Canvas :'),
                    'texts' : ("Return a list of values describing the vertex and edge closest to the window coordinates x and y in the item described by tagOrId. If  tagOrId describes more than one item, the first item in display list order that supports vertex picking is used. The list consists of the index of the contour containing the returned vertices, the index of the closest vertex and the index of a vertex next to the closest vertex that identify the closest edge (located between the two returned vertices).",
                               "Waypoints items have been initially designed for figuring out typical fixed position objects (i.e. beacons or fixes in the ATC vocabulary) with associated block of texts on a radar display for Air Traffic Control. They supports mouse event handling and interactions. However they may certainly be used by other kinds of radar view or even by other kind of plan view with many geographical objects and associated textual information.",
                               "TkZinc was firstly designed for X11 server. Since the 3.2.2 version, TkZinc also offers as a runtime option, the support for openGL rendering, giving access to features such as antialiasing, transparency, color gradients and even a new, openGL oriented, item type : triangles  . In order to use the openGL features, you need the support of the GLX extension on your X11 server. We also succeeded in using TkZinc with openGL on the Exceed X11 server (running on windows and developped by Hummingbird) with the 3D extension. ",
                               "No TkZinc KeyWord with Y initial letter...",
                               "TkZinc widgets are very similar to Tk Canvases in that they support structured graphics. But unlike the Canvas, TkZinc can structure the items in a hierarchy, has support for affine 2D transforms, clipping can be set for sub-trees of the item hierarchy, the item set is quite more powerful including field specific items for Air Traffic systems and new rendering techniques such as transparency and gradients. If needed, it is also possible to extend the item set in an additionnal dynamic library through the use of a C api.",
                               ),
		       },
             }

#----------------------------------------------------------------------- fin de MAIN

def resetTransfo():
    zinc.raiseitem('move')
    zinc.treset('move')
    zinc.treset(curview)
    
    
#-----------------------------------------------------------------------------------
# Callback sur evt CLICK des items tagés 'divider'
#-----------------------------------------------------------------------------------
def selectDivider (divname = None , numpage = None):
    global curview
    if (divname is None) :
        tags = zinc.itemcget('current', 'tags')
        divname = tags[0]
        numpage = int(tags[2])

    zinc.itemconfigure("(%s && titre)"%(divname), color = '#000099')
    zinc.itemconfigure("(%s && intercalaire)"%(divname), linewidth = 1.4)
    zinc.itemconfigure("(%s && page)"%(divname), visible = 0)

    divgroup = zinc.group("(%s && %s)"%(divname, numpage))
    zinc.raiseitem(divgroup)
    curview = "(%s && %s && content)"%(divname, numpage)
    zinc.itemconfigure("(%s && %s && titre)"%(divname, numpage), color = '#000000')
    zinc.itemconfigure("(%s && %s && intercalaire)"%(divname, numpage), linewidth = 2);
    zinc.itemconfigure("(%s && %s && page)"%(divname, numpage), visible = 1)

    if (divname == 'div2') :
        fontname = tabtables[tabanchor]['names'][numpage]
        explain = tabtables[tabanchor]['texts'][numpage]
        text = "%s\n\n%s"%(fontname, explain)
        zinc.itemconfigure("(%s && fontname)"%(divname),
                           text = text)
        zinc.raiseitem("(%s && fontname)"%(divname))


#-----------------------------------------------------------------------------------
# Callback sur evt CLICK des items tagés 'selector'
#-----------------------------------------------------------------------------------
def clickSelector(btngroup = None , value = None):
    global tabalign
    global tabanchor
    if (btngroup is None and value is None):
        tags = zinc.itemcget('current', 'tags')
        btngroup = tags[0]
        value = tags[1]

    zinc.treset(btngroup)
    zinc.itemconfigure("(%s && btntext)"%(btngroup), color = '#444444')
    zinc.itemconfigure("(%s && %s && btntext)"%(btngroup, value) , color = '#2222bb')
    zinc.translate("(%s && %s)"%(btngroup, value), 0, 1)

    if (value in ('n', 'e', 's', 'w')) :
        tabanchor = value

    elif (value == 'left' or value == 'center' or value == 'right') :
        tabalign = value

    tabtable = tabtables[tabanchor]
    numpages = tabtable['numpages']
    tabparams = { 'radius' : 8,
                  'tabwidth' : 72,
                  'tabheight' : 28,
                  'numpages' : numpages,
                  'anchor' : tabanchor,
                  'alignment' : tabalign,
                  'overlap' : 3,
                  }

    (shapes, tcoords, inverse) = tabbox_coords(((-240, -160), (240, 100)), **tabparams)

    for index in xrange(7, -1, -1):
        divgroup = zinc.group("(div2 && %s && intercalaire)"%(index))
        zinc.itemconfigure(divgroup,
                           visible = (index < numpages))

        if (index >= numpages) :
            zinc.loweritem(divgroup)
        else :
            zinc.raiseitem(divgroup)
            zinc.itemconfigure("(div2 && %s)"%(index),
                               visible = 1)
            zinc.coords("(div2 && %s && intercalaire)"%(index),
                        tuple(shapes[index]))
            if (zinc.type("(div2 && %s && titre)"%(index))) :
                zinc.coords("(div2 && %s && titre)"%(index), tcoords[index])
                zinc.itemconfigure("(div2 && %s && titre)"%(index),
                                   text = tabtable['titles'][index])
    selectDivider('div2', 0)

def setBindings():
    # grab keyboard
    mw.focus()

    # plus,moins : Zoom++, Zoom--
    mw.bind('<plus>', lambda ev: viewZoom('up'))
    mw.bind('<minus>', lambda ev: viewZoom('down'))
    
    # Up, Down, Right, Left : Translate
    mw.bind('<KeyPress-Up>', lambda ev: viewTranslate('up'))
    mw.bind('<KeyPress-Down>', lambda ev: viewTranslate('down'))
    mw.bind('<KeyPress-Left>', lambda ev: viewTranslate('left'))
    mw.bind('<KeyPress-Right>', lambda ev: viewTranslate('right'))

    
    # >, < : Rotate counterclockwise et clockwise
    mw.bind('<greater>', lambda ev: viewRotate('cw'))
    mw.bind('<less>', lambda ev: viewRotate('ccw'))
    
    def printMsg(*arg, **kw):
        for i in arg :
            print "--> %s : %s"%(i, zinc)
        for i,j in kw.items():
            print "%s --> %s"%(i, j)
            
    # Escape : reset transfos
    mw.bind('<Escape>', lambda ev, : resetTransfo())
    
    zinc.bind_tag('divider', '<1>', lambda ev : selectDivider())

    zinc.bind_tag('selector', '<1>', lambda ev : clickSelector())

    zinc.bind_tag('move', '<1>', lambda ev : mobileStart(ev))
    zinc.bind_tag('move', '<B1-Motion>', lambda ev : mobileMove(ev))
    zinc.bind_tag('move', '<ButtonRelease>', lambda ev : mobileStop(ev))
    
    zinc.bind_tag('pushbtn', '<1>', lambda ev : pushButton())
    zinc.bind_tag('pushbtn', '<ButtonRelease>', lambda ev : pullButton())
    
    zinc.bind_tag('poly', '<1>', lambda ev : startRotatePolygone(ev))
    zinc.bind_tag('poly', '<B1-Motion>', lambda ev : rotatePolygone(ev))


#-----------------------------------------------------------------------------------
# Callback sur evt CLICK des items tagés 'pushbtn'
#-----------------------------------------------------------------------------------
def pushButton ():
  tag = zinc.itemcget('current', 'tags')[0]
  if (len(zinc.find('withtag', tag)) > 1
      and not zinc.find('withtag', "(%s && ico)"%(tag))):
      tag = 'current'
  zinc.scale(tag, .975, .975)
  zinc.translate(tag, 1, 1)

  if (zinc.find('withtag', "(%s && ico)"%(tag))) :
      oldcolor = zinc.itemcget("(%s && ico)"%(tag),
                               'fillcolor')
      zinc.itemconfigure('ico',
                         fillcolor = '#000000')

      if (oldcolor == '#000000') :
          newcolor = '#ffff00'
      else :
          newcolor = '#000000'
      zinc.itemconfigure("(%s && ico)"%(tag),
                         fillcolor = newcolor)
  
#-----------------------------------------------------------------------------------
# Callback sur evt RELEASE des items tagés 'pushbtn'
#-----------------------------------------------------------------------------------
def pullButton ():
    tag = zinc.itemcget('current', 'tags')[0]
    zinc.treset(tag)


#-----------------------------------------------------------------------------------
# Callback sur evt CATCH des items tagés 'poly'
# armement de rotation des polygones
#-----------------------------------------------------------------------------------
def startRotatePolygone (ev):
    global previousangle
    (xref, yref) = zinc.transform(zinc.group('current'), 1, (0, 0))
    previousangle = line_angle((ev.x, ev.y), (xref, yref))

#-----------------------------------------------------------------------------------
# Callback sur evt MOTION des items tagés 'poly'
# rotation des polygones
#-----------------------------------------------------------------------------------
def rotatePolygone (ev):
    global previousangle
    tag = zinc.itemcget('current', 'tags')[0]
    (xref, yref) = zinc.transform(zinc.group('current'),
                                  1,
                                  (0, 0))
    newangle = line_angle((ev.x, ev.y),
                          (xref, yref))

    zinc.rotate(tag,
                math.radians(newangle - previousangle))
    previousangle = newangle

#-----------------------------------------------------------------------------------
# Callback CATCH de sélection (début de déplacement) des items tagés 'move'
#-----------------------------------------------------------------------------------
def mobileStart (ev):
    global dx, dy
    (dx, dy) = (0 - ev.x, 0 - ev.y)
    zinc.raiseitem('current')



#-----------------------------------------------------------------------------------
# Callback MOVE de déplacement des items tagés 'move'
#-----------------------------------------------------------------------------------
def mobileMove (ev):
    global dx, dy
    zinc.translate('current',
                   ev.x + dx,
                   ev.y +dy)
    (dx, dy) = (0 - ev.x, 0 - ev.y)


#-----------------------------------------------------------------------------------
# Callback RELEASE de relaché (fin de déplacement) des items tagés 'move'
#-----------------------------------------------------------------------------------
def mobileStop (ev):
    mobileMove(ev)


#-----------------------------------------------------------------------------------
# Callback sur evénément Tk <KeyPress> flèche gauche, haut, droite, bas
# pan (translation) du contenu de la page active (TabBox)
#-----------------------------------------------------------------------------------
def viewTranslate (way):
    if (way == 'left') :
        dx = -10
    elif (way == 'right') :
        dx = 10
    else :
        dx = 0
    if (way == 'up') :
        dy = -10
    elif (way == 'down') :
        dy = 10
    else:
        dy = 0
    
    zinc.translate(curview, dx, dy);

#-----------------------------------------------------------------------------------
# Callback sur evénément Tk <KeyPress> "+" ou "-"
# zoom du contenu de la page active (TabBox)
#-----------------------------------------------------------------------------------
def viewZoom (key) :
    global curview
    if (key == 'up') :
        scaleratio =  1 + zoomfactor
    else :
        scaleratio = 1 - zoomfactor
    
    zinc.scale(curview, scaleratio, scaleratio);



#-----------------------------------------------------------------------------------
# Callback sur evénément Tk <KeyPress> ">" ou "<"
# rotation du contenu de la page active (TabBox)
#-----------------------------------------------------------------------------------
def viewRotate (way) :
    delta_angle = rotate_angle
    if (way == 'cw') :
        delta_angle *= -1 

    zinc.rotate(curview, delta_angle)


# creation de la fenetre principale
mw = Tkinter.Tk()
mw.geometry("700x560+0+0")
mw.title('Test Graphics Module')


# creation du widget Zinc
zinc = Zinc.Zinc(render = 1,
                 width = 700,
                 height = 560,
                 borderwidth = 0,
                 lightangle = 140,
                 backcolor = '#cccccc',)
zinc.pack(fill = 'both', expand = 1)


# initialise les gradients nommés
pictorial.set_gradients(zinc, **gradset)

# création de la vue principale
tgroup = zinc.add('group', 1)
zinc.coords(tgroup, (350, 240))

# consigne globale
zinc.add('text', 1,
         position = (50, 470),
         text = "Global interations :\n<Up>, <Down>, <Left> and <Right> keys move content of TabBox pages\n<Plus> and <Minus> keys zoom out and zoom in this page\n<Greater> and <Less> keys rotate this page\n<Escape> key reset transfos",
         font = font_9b,
         color = '#555555',
         spacing = 2,
        )

# Création des pages d'exemples
(shapes, tcoords, inverse) = tabbox_coords(((-315, -210), (315, 210)),
                                          numpages = 7,
                                          overlap = 2,
                                          radius = 8,
                                          tabheight = 26,
                                          tabwidth = [92, 100 ,82 ,82 ,82 ,120 , 80],
                                          )

# to find some images (used as textures) needed by this demo
texture = pictorial.get_image(zinc, 'paper.gif')
# création des items zinc correspondants
i = len(shapes) - 1
pagenames = ['Rectangle', 'Hippodrome', 'Polygone', 'Polyline', 'PathLine', 'MultiContours', 'TabBox']
pagegroups=[]

lshapes=list(shapes)
lshapes.reverse()
currentcoords=coords2lpts(tcoords)
for shape in  lshapes:
    divgroup = zinc.add('group', tgroup)

    # création de l'intercalaire
    divider = zinc.add('curve',
                       divgroup,
                       lpts2coords(shape),
                       closed = 1,
                       priority = 10,
                       linewidth = 1,
                       linecolor = '#000000',
                       filled = 1,
                       tile = texture,
                       tags = ('div1', 'divider', i, 'intercalaire'),
                     )

    # groupe page clippé
    page = zinc.add('group',
                    divgroup,
                    priority = 100,
                    tags = ('div1', i, 'page'),
                    )
    clip = zinc.add('rectangle',
                    page,
                    ((-300, -170), (300, 195)),
                    linewidth = 1,
                    linecolor = '#000099',
                    filled = 1,
                    fillcolor = '#000000;4',
                    )
    zinc.itemconfigure(page, clip = clip)
    
    pgroup = zinc.add('group', page,
                      tags = ('div1', i, 'content'),
                      )

    pagegroups.append(pgroup)

    currentcoords[i][1] -= 6
    
    
    # titre de l'intercalaire
    zinc.add('text',
             divgroup,
             position = tuple(currentcoords[i]),
             text = pagenames[i],
	     font = font_9b,
	     alignment = 'center',
	     anchor = 'n',
	     color = '#000099',
	     priority = 200,
	     tags = ('div1', 'divider', i, 'titre'),
             )
    i-= 1


# création du contenu des pages
i = 0
pagenames.reverse()
for pagename  in pagenames:
    if ( pagesconf.has_key(pagename)) :
        pagestyle = pagesconf[pagename]
        pgroup = pagegroups[i]
        for ( itemname, itemstyle) in  pagestyle.items() :
            if (itemname == 'consigne') :
                group = zinc.group(pgroup)
            else:
                group = pgroup
            itemstyle['name'] = itemname
            build_zinc_item(zinc, group, **itemstyle)

    i+=1



# initialisation de la TabBox
clickSelector('sel1', 'n')
clickSelector('sel2', 'left')
selectDivider('div1', 0)

# initialisation des bindings
setBindings()


mw.mainloop()


#Local Variables:
#mode : python
#tab'width' : 4
#end: