-
Notifications
You must be signed in to change notification settings - Fork 1
/
gap12.py
689 lines (611 loc) · 25.5 KB
/
gap12.py
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
#-----------------------------------------------------------------------------
# Name: GAP
# Purpose: Graphics Agnostic Python
#
# Author: Ti Leyon
#
# Created: 04/07/2017
# Copyright: (c) Ti Leyon 2017
# Licence: This work is licensed under the
# Creative Commons Attribution-ShareAlike 4.0
# International License.
# To view a copy of this license, visit:
# http://creativecommons.org/licenses/by-sa/4.0/
# or send a letter to:
# Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
#-----------------------------------------------------------------------------
class unipage(object):
def __init__(self, kivy, screen_size):
self.kivy = kivy
self.screen_size = screen_size
self.unibuttons = []
self.unitexts = []
self.unilabels = []
self.unimages = []
self.uniframes = []
self.xratio = self.screen_size[0] / 800.0
self.yratio = self.screen_size[1] / 600.0
def setscreen(self):
if self.kivy:
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window
from kivy.utils import platform as core_platform
self.root = FloatLayout()
if (self.xratio == 0) or (self.yratio == 0):
if core_platform == 'android':
self.screen_size = Window.size
if self.screen_size[0] < self.screen_size[1]:
x = self.screen_size[0]
y = self.screen_size[0] / 4 * 3
self.screen_size = (x, y)
else:
self.screen_size = (800, 600)
self.xratio = self.screen_size[0] / 800.0
self.yratio = self.screen_size[1] / 600.0
if core_platform == 'android':
Window.softinput_mode = 'pan'
else:
Window.size = self.screen_size
else:
import ui
if (self.xratio == 0) or (self.yratio == 0):
ss1 = ui.get_screen_size()[0]
ss3 = ui.get_screen_size()[1]
notoptimal = True
while notoptimal:
if ss1 % 8 == 0:
notoptimal = False
else:
ss1 -= 1
ss2 = (ss1 / 4) * 3
title_bar_height = int(ss3 / 600 * 50)
if ss2 > ss3 - title_bar_height:
ss2 = ss3 - title_bar_height
notoptimal = True
while notoptimal:
if ss2 % 6 == 0:
notoptimal = False
else:
ss2 -= 1
ss1 = (ss2 / 3) * 4
self.screen_size = (ss1, ss2)
self.xratio = ss1 / 800
self.yratio = ss2 / 600
self.root = ui.View(frame=(0,0,self.screen_size[0], \
self.screen_size[1]))
def unibutton(self, params):
self.unibuttons.append([])
if len(params) == 6:
function = params[5]
else:
function = nofunction
if self.kivy:
from kivy.uix.button import Button
self.unibuttons[len(self.unibuttons) - 1] = Button(
text = params[4],
size_hint_y = None,
size_hint_x = None,
height = params[3] * self.yratio,
width = params[2] * self.xratio,
font_size = 17.5 * self.yratio,
pos = (params[0] * self.xratio, params[1] * self.yratio),
on_press = function )
self.root.add_widget(self.unibuttons[len(self.unibuttons) - 1])
else:
import ui
self.unibuttons[len(self.unibuttons) - 1] = ui.Button(frame= \
(params[0] * self.xratio, (600 - params[1] - \
params[3]) * self.yratio, \
params[2] * self.xratio, params[3] * self.yratio), \
title = params[4])
self.unibuttons[len(self.unibuttons) - 1].background_color \
= (0.4,0.4,0.4)
self.unibuttons[len(self.unibuttons) - 1].action = function
self.unibuttons[len(self.unibuttons) - 1].height = params[3] * \
self.xratio
self.unibuttons[len(self.unibuttons) - 1].width = params[2] * \
self.yratio
self.unibuttons[len(self.unibuttons) - 1].tint_color = 'white'
self.unibuttons[len(self.unibuttons) - 1].font = ('<system>', \
17.5 * self.yratio)
self.root.add_subview(self.unibuttons[len(self.unibuttons) - 1])
def unitext(self, params):
self.unitexts.append([])
if self.kivy:
from kivy.uix.textinput import TextInput
self.unitexts[len(self.unitexts) - 1] = TextInput (
id = 'text' + str(len(self.unitexts) - 1),
size_hint_y = None,
size_hint_x = None,
height = params[3] * self.yratio,
width = params[2] * self.xratio,
text = params[4],
multiline = True,
font_size = 17.5 * self.yratio,
pos = (params[0] * self.xratio, params[1] * self.yratio))
self.root.add_widget(self.unitexts[len(self.unitexts) - 1])
else:
import ui
self.unitexts[len(self.unitexts) - 1] = ui.TextField(frame=
(params[0] * self.xratio, (600 - params[1] - params[3]) * \
self.yratio, params[2] * self.xratio, params[3] * self.yratio))
self.unitexts[len(self.unitexts) - 1].bordered = False
self.unitexts[len(self.unitexts) - 1].background_color = 'white'
self.unitexts[len(self.unitexts) - 1].font = ('<system>', 17.5 * \
self.yratio)
self.unitexts[len(self.unitexts) - 1].text = params[4]
self.root.add_subview(self.unitexts[len(self.unitexts) - 1])
def unilabel(self, params):
self.unilabels.append([])
if self.kivy:
from kivy.uix.label import Label
self.unilabels[len(self.unilabels) - 1] = Label(pos = \
(params[0] * self.xratio, params[1] * self.yratio), \
size_hint=(1.0,1.0), halign="left", \
valign="bottom", text = params[4])
self.unilabels[len(self.unilabels) - 1].font_size = 17.5 * \
self.yratio
self.unilabels[len(self.unilabels) - 1].bind(size= \
self.unilabels[len(self.unilabels) - 1].setter('text_size'))
self.root.add_widget(self.unilabels[len(self.unilabels) - 1])
else:
import ui
self.unilabels[len(self.unilabels) - 1] = ui.Label(frame= \
(params[0] * self.xratio, (600 - params[1] - params[3]) * \
self.yratio, params[2] * self.xratio, params[3] * self.yratio))
self.unilabels[len(self.unilabels) - 1].text = params[4]
self.unilabels[len(self.unilabels) - 1].text_color = 'white'
self.unilabels[len(self.unilabels) - 1].alignment = \
ui.ALIGN_LEFT
self.unilabels[len(self.unilabels) - 1].font = ('<system>', 18 * \
self.yratio)
self.root.add_subview(self.unilabels[len(self.unilabels) - 1])
def unimage(self, params):
self.unimages.append([])
if self.kivy:
from kivy.uix.image import Image
self.unimages[len(self.unimages) - 1] = Image( source= params[4],
allow_stretch = True, size_hint = (None, None),
size=(params[2] * self.xratio, params[3] * self.yratio),
pos=(params[0] * self.xratio, params[1] * self.yratio))
self.root.add_widget(self.unimages[len(self.unimages) - 1])
else:
import ui
self.unimages[len(self.unimages) - 1] = (ui.ImageView
(name = 'Image', frame = (params[0] * self.xratio, \
(600 - params[1] - params[3]) * self.yratio, \
params[2] * self.xratio, params[3] * self.yratio)))
self.root.add_subview (self.unimages[len(self.unimages) - 1])
self.unimages[len(self.unimages) - 1].image = \
ui.Image.named(params[4])
def uniframe(self, params):
if self.kivy:
from kivy.graphics import Color
from kivy.graphics import Rectangle
self.root.canvas.add(Color (params[4][0],params[4][1], \
params[4][2]))
self.root.canvas.add(Rectangle(pos = (params[0] * self.xratio, \
params[1] * self.yratio), size = (params[2] * self.xratio, \
params[3] * self.yratio)))
else:
import ui
self.uniframes.append([])
self.uniframes[len(self.uniframes) - 1] = \
ui.View(frame=(params[0] * self.xratio, \
(600 - params[1] - params[3]) * self.yratio, \
params[2] * self.xratio, params[3] * self.yratio))
self.uniframes[len(self.uniframes) - 1].background_color = \
(params[4][0],params[4][1], params[4][2],1.0)
self.root.add_subview(self.uniframes[len(self.uniframes) - 1])
def showpage(self):
if self.kivy:
from kivy.base import runTouchApp
runTouchApp(self.root)
else:
self.root.present('sheet')
class uniscreen(unipage):
def __init__(self, screendef):
try:
from kivy.uix.floatlayout import FloatLayout
kivy = True
except:
import ui
kivy = False
unipage.__init__(self, kivy, screendef[0])
self.setscreen()
self.screendef = screendef
def setpage(self):
for k in range(1, len(self.screendef)):
self.screendef[k][0](self, self.screendef[k][1])
def closepage(sender):
try:
from kivy.utils import platform as core_platform
from kivy.core.window import Window
import sys
if core_platform == 'android':
sys.exit()
else:
Window.close()
except:
sender.superview.close()
def nofunction(sender):
pass
ss = [(800,600)]
gui_object = object
if uniscreen(ss).kivy == True:
from kivy.uix.widget import Widget
gui_object = Widget
else:
import ui
gui_object = ui.View
class movables(gui_object):
def touch_began(self, touch):
self.new_objs = new_widgets.new_objs
self.selected_obj = new_widgets.selected_obj
class new_touch(object):
def __init__(self):
self.x = touch.location.x
self.y = touch.location.y
Touch = new_touch()
self.touch_down (None, Touch)
def touch_moved(self, touch):
class new_touch(object):
def __init__(self):
self.x = touch.location.x
self.y = touch.location.y
Touch = new_touch()
self.touch_move (None, Touch, True)
def close(self):
ui.View.close(self)
def update_all(self):
if self.selected_obj != None:
mypage.unitexts[0].text = str(
self.new_objs[self.selected_obj].pos[0])
mypage.unitexts[1].text = str(
self.new_objs[self.selected_obj].pos[1])
mypage.unitexts[2].text = str(
self.new_objs[self.selected_obj].width)
mypage.unitexts[3].text = str(
self.new_objs[self.selected_obj].height)
else:
for x in range (4):
mypage.unitexts[x].text = 'None'
if mypage.kivy == False:
new_widgets.selected_obj = self.selected_obj
def is_in_box(self, obj, touch):
obj_clicked = False
if (touch.x >= obj.x) and (touch.x <= (obj.x + obj.width)):
if (touch.y >= obj.y) and(touch.y <= (obj.y + obj.height)):
obj_clicked = True
return obj_clicked
def good_move(self, x, y, disp):
if disp:
y = (600 * mypage.yratio) - y
if self.new_objs [self.selected_obj].width + x > (698 * mypage.xratio):
x = (698 * mypage.xratio) - self.new_objs [self.selected_obj].width
if x < (12 * mypage.xratio):
x = (12 * mypage.yratio)
if self.new_objs [self.selected_obj].height + y > (594 * mypage.yratio):
y = (594 * mypage.yratio) - self.new_objs [self.selected_obj].height
if y < (80 * mypage.yratio):
y = (80 * mypage.yratio)
if disp:
y = (600 * mypage.yratio) - y - self.new_objs [self.selected_obj].height
return (round(x), round(y))
def good_height(self, h):
if self.new_objs [self.selected_obj].y + h > (594 * mypage.yratio):
h = (594 * mypage.yratio) - self.new_objs [self.selected_obj].y
return (round(h))
def good_width(self, w):
if self.new_objs [self.selected_obj].x + w > (698 * mypage.xratio):
w = (698 * mypage.xratio) - self.new_objs [self.selected_obj].x
return round(w)
def touch_down(self, sender, touch):
if mypage.kivy:
bottom = touch.y > 80 * mypage.yratio
else:
bottom = touch.y < 525 * mypage.yratio
if touch.x < (698 * mypage.xratio) and bottom:
cur_obj = len(self.new_objs) -1
check_pos = cur_obj >= 0
while check_pos:
if self.is_in_box (self.new_objs[cur_obj], touch):
check_pos = False
else:
cur_obj -= 1
if cur_obj == -1:
check_pos = False
if cur_obj == -1:
if self.selected_obj != None:
self.new_objs[self.selected_obj].background_color = \
self.new_objs[self.selected_obj].color
self.selected_obj = None
else:
if self.selected_obj != None:
self.new_objs[self.selected_obj].background_color = \
self.new_objs[self.selected_obj].color
self.selected_obj = cur_obj
self.new_objs[self.selected_obj].background_color = (1,0,0,1)
self.update_all()
def touch_move(self, sender, touch, disp=False):
if mypage.kivy:
bottom = touch.y > 80 * mypage.yratio
else:
bottom = touch.y < 525 * mypage.yratio
if self.selected_obj != None and touch.x < (698 * mypage.xratio) \
and bottom:
self.new_objs[self.selected_obj].pos = \
self.good_move(touch.x, touch.y, disp)
if not(mypage.kivy):
self.new_objs[self.selected_obj].x = \
round(self.new_objs[self.selected_obj].pos[0])
self.new_objs[self.selected_obj].y = \
round(self.new_objs[self.selected_obj].pos[1])
self.update_all()
class newobjects (movables):
def __init__(self):
import os
self.fullpath = (__file__)
self.base_py = os.path.basename(__file__)
self.new_objs = []
self.selected_obj = None
self.count_objs = 0
def new_button(self):
a_caption = 'Button' + '{:02d}'.format(self.count_objs)
self.count_objs += 1
mypage.unibutton((40, 80, 80, 40, a_caption))
a_button = mypage.unibuttons [-1]
a_button.color = a_button.background_color
if mypage.kivy:
a_button.bind(on_touch_move=self.touch_move)
a_button.bind(on_touch_down=self.touch_down)
else:
a_button.touch_enabled = False
a_button.color = a_button.background_color
a_button.pos = (a_button.x, a_button.y)
self.new_objs.append(a_button)
def new_text(self):
def android_focus(sender, value):
sender.focus = False
a_caption = 'Text' + '{:02d}'.format(self.count_objs)
self.count_objs += 1
mypage.unitext((40, 160, 200, 30, a_caption))
a_text = mypage.unitexts [-1]
a_text.height = 30.0
a_text.color = a_text.background_color
if mypage.kivy:
a_text.bind(on_touch_down=self.touch_down)
a_text.bind(on_touch_move=self.touch_move)
from kivy.utils import platform as core_platform
if core_platform == 'android':
a_text.bind(focus=android_focus)
else:
a_text.touch_enabled = False
a_text.pos = (a_text.x, a_text.y)
self.new_objs.append(a_text)
def new_label(self):
a_caption = 'Label' + '{:02d}'.format(self.count_objs)
self.count_objs += 1
mypage.unilabel((40, 240, 80, 20, a_caption))
a_label = mypage.unilabels [-1]
a_label.size_hint=(None,None)
a_label.height = 20;
if mypage.kivy:
a_label.background_color = a_label.color
a_label.bind(on_touch_down=self.touch_down)
a_label.bind(on_touch_move=self.touch_move)
else:
a_label.touch_enabled = False
a_label.pos = (a_label.x, a_label.y)
a_label.color = a_label.background_color
self.new_objs.append(a_label)
def new_image(self):
a_caption = 'Image' + '{:02d}'.format(self.count_objs)
self.count_objs += 1
mypage.unibutton((40, 360, 80, 80, a_caption))
an_image = mypage.unibuttons [-1]
an_image.background_color = (0,1,0,1)
an_image.color = an_image.background_color
if mypage.kivy:
an_image.bind(on_touch_move=self.touch_move)
an_image.bind(on_touch_down=self.touch_down)
else:
an_image.touch_enabled = False
an_image.color = an_image.background_color
an_image.pos = (an_image.x, an_image.y)
self.new_objs.append(an_image)
def new_frame(self):
a_caption = 'Frame' + '{:02d}'.format(self.count_objs)
self.count_objs += 1
mypage.unibutton((40, 480, 80, 80, a_caption))
a_frame = mypage.unibuttons [-1]
a_frame.background_color = (0,0,1,1)
a_frame.color = a_frame.background_color
if mypage.kivy:
a_frame.bind(on_touch_move=self.touch_move)
a_frame.bind(on_touch_down=self.touch_down)
else:
a_frame.touch_enabled = False
a_frame.color = a_frame.background_color
a_frame.pos = (a_frame.x, a_frame.y)
self.new_objs.append(a_frame)
def function_1(sender):
mypage.unitexts[0].text = 'Oh! You clicked my button.'
def do_label(sender):
new_widgets.new_label()
def do_text(sender):
new_widgets.new_text()
def do_button(sender):
new_widgets.new_button()
def do_image(sender):
new_widgets.new_image()
def do_frame(sender):
new_widgets.new_frame()
def drags(sender):
new_widgets.new_button()
new_widgets.new_text()
new_widgets.new_label()
for x in range (len(new_widgets.new_objs)):
mypage.root.add_widget (new_widgets.new_objs[x])
def delete_object(sender):
if new_widgets.selected_obj != None:
dead_obj = new_widgets.new_objs.pop(new_widgets.selected_obj)
if mypage.kivy:
mypage.root.remove_widget(dead_obj)
else:
mypage.root.remove_subview(dead_obj)
new_widgets.selected_obj = None
def modify_object(sender):
if mypage.kivy:
disp = False
else:
disp = True
if new_widgets.selected_obj != None:
try:
if disp:
mypage.unitexts[1].text = str(float(mypage.unitexts[1].text) + \
new_widgets.new_objs[new_widgets.selected_obj].height)
new_widgets.new_objs[new_widgets.selected_obj].pos = \
new_widgets.good_move(float(mypage.unitexts[0].text), \
float(mypage.unitexts[1].text), disp)
except:
pass
try:
new_widgets.new_objs[new_widgets.selected_obj].width = \
new_widgets.good_width(float(mypage.unitexts[2].text))
except:
pass
try:
new_widgets.new_objs[new_widgets.selected_obj].height = \
new_widgets.good_height(float(mypage.unitexts[3].text))
except:
pass
if disp:
new_widgets.new_objs[new_widgets.selected_obj].x = \
new_widgets.new_objs[new_widgets.selected_obj].pos[0]
new_widgets.new_objs[new_widgets.selected_obj].y = \
new_widgets.new_objs[new_widgets.selected_obj].pos[1]
new_widgets.update_all()
def function_holders(objs):
funcs = ''
for obj in objs:
try:
s = obj.text
except:
s = obj.title
if s[0] == 'B':
funcs = funcs + '\ndef do_' + s + '(sender):\n'
funcs = funcs + ' pass\n\n'
return funcs
def build_obj(obj, disp):
def fix(number, height):
if not(disp):
number= 600 - (abs(round(number + (80 * 4/3 * 7/8)))) + 6 - height
return str(number)
try:
s = obj.text
except:
s = obj.title
kind = ['unibutton', 'unitext', 'unilabel', 'unimage', 'uniframe']
obj_type = kind[['B','T','L','I','F'].index(s[0])]
string_out = '(' + obj_type + ", (" + \
str(round((obj.x - (12 * mypage.xratio)) / mypage.xratio * 4/3 * 7/8) \
) + ', ' + fix(round((obj.y - (80 * mypage.yratio)) / mypage.yratio * \
4/3 * 7/8), round(obj.height / mypage.yratio* 4/3 * 7/8)) + ', ' \
+ str(round(obj.width / mypage.xratio * 4/3 * 7/8)) + ', ' + \
str(round(obj.height / mypage.yratio * 4/3 * 7/8))
if obj_type == 'uniframe':
string_out += ', (.5,.5,.5)'
elif obj_type == 'unimage':
if disp:
string_out += ", 'data/logo/kivy-icon-512.png'"
else:
string_out += ", 'test:Pythonista'"
else:
string_out += ", '" + s + "'"
if obj_type == 'unibutton':
string_out += ", do_" + s
string_out += ')),'
return string_out
def save_page(sender):
page_in = open(new_widgets.base_py, 'r')
lines = page_in.readlines()
page_out = open('gapout.py', 'w')
cnt = 0
for z in range (259):
s = lines[z]
if z == 1:
s = s[0:len(s)-1] + ' (Output)\n'
page_out.writelines(s)
cnt = cnt + 1
page_out.writelines(function_holders(new_widgets.new_objs))
page_out.writelines("if __name__ == '__main__':\n")
page_out.writelines(' unilabel = unipage.unilabel\n')
page_out.writelines(' uniframe = unipage.uniframe\n')
page_out.writelines(' unitext = unipage.unitext\n')
page_out.writelines(' unibutton = unipage.unibutton\n')
page_out.writelines(' unimage = unipage.unimage\n')
page_out.writelines(' widgets = [(600, 450),\n')
for x in range (len(new_widgets.new_objs)):
page_out.writelines(' ' + build_obj(new_widgets.new_objs[x], \
mypage.kivy) + '\n')
page_out.writelines(' ]\n')
page_out.writelines(' mypage = uniscreen(widgets)\n')
page_out.writelines(' mypage.setpage()\n')
page_out.writelines(' mypage.showpage()\n')
page_in.close()
page_out.close()
if __name__ == '__main__':
unilabel = unipage.unilabel
uniframe = unipage.uniframe
unitext = unipage.unitext
unibutton = unipage.unibutton
unimage = unipage.unimage
tut = 'Graphics Agnostic Python (GAP) uses the top 5 buttons to create new '
tut = tut + 'widgets. You can '
tut2 = 'select and drag them to any position on the virtual screen (black '
tut2 = tut2 + 'frame), delete selected'
tut3 = 'objects or precisely alter them by changing the parameters. Save '
tut3 = tut3 + 'a page as "gapout.py".'
widgets = [(700, 525),
(uniframe,(0, 0, 800, 600,(.6,.6,.6))),
(uniframe,(10, 75, 688,520 ,(0,0,0))),
(unibutton,(710, 560, 80, 30, 'Button', do_button)),
(unibutton,(710, 520, 80, 30, 'Input', do_text)),
(unibutton,(710, 480, 80, 30, 'Label', do_label)),
(unibutton,(710, 440, 80, 30, 'Image', do_image)),
(unibutton,(710, 400, 80, 30, 'Frame', do_frame)),
(unibutton,(710, 360, 80, 30, 'Delete', delete_object)),
(uniframe,(710, 180, 80,150, (0,0,0))),
(unilabel,(710, 300, 20, 20, 'X')),
(unilabel,(710, 260, 20, 20, 'Y')),
(unilabel,(710, 220, 20, 20, 'W')),
(unilabel,(710, 180, 20, 20, 'H')),
(unitext,(730, 300, 60, 30, 'None')),
(unitext,(730, 260, 60, 30, 'None')),
(unitext,(730, 220, 60, 30, 'None')),
(unitext,(730, 180, 60, 30, 'None')),
(unibutton,(710, 140, 80, 30, 'Modify', modify_object)),
(unibutton,(710, 75, 80, 30, 'Save', save_page)),
(unibutton,(710, 20, 80, 30, 'Exit', closepage)),
(uniframe,(10, 5, 688,65 ,(0,0,0))),
(unilabel,(15, 50, 670, 20, tut)),
(unilabel,(15, 30, 670, 20, tut2)),
(unilabel,(15, 10, 670, 20, tut3)),
]
mypage = uniscreen(widgets)
if mypage.kivy == False:
mypage.root = movables(frame=(0,0,mypage.screen_size[0], \
mypage.screen_size[1]))
mypage.setpage()
if mypage.kivy == False:
for x in range(3,7):
mypage.unilabels[x].font = ('<system>', 16 * mypage.xratio)
mypage.unilabels[x].touch_enabled = False
for x in range(4):
mypage.unitexts[x].font = ('<system>', 16 * mypage.xratio)
mypage.uniframes[3].touch_enabled = False
new_widgets = newobjects()
mypage.showpage()