-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.py
More file actions
38 lines (25 loc) · 1.33 KB
/
demo.py
File metadata and controls
38 lines (25 loc) · 1.33 KB
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
import os
from pprint import pformat
from CV2SUI.cv2sui import cv2sui
import cv2
import numpy as np
MainUI = cv2sui(window_name="CV2 UI Demo", width=800, height=600, level=0, contextArea={"textArea": (50, 50, 400, 200),
"imgArea":(50, 300, 150, 200)})
MainUI.add_button("(S)how Text", (110, 10),key='s', callback=lambda: MainUI.add_textDirectlyInFrame("demoText", "Hello, CV2SUI!", (400, 300)))
MainUI.add_button("ShowToast", (10, 10), key='t', callback=lambda: MainUI.changeLevel(1))
MainUI.add_button("ButtonA",label="CV2SUI",positionXY= (250, 10))
def simpleIterator():
count = 0
while True:
strCount = str(count)
yield strCount
count += 1
myIterator1 = simpleIterator()
MainUI.add_button("Change Button's Label", (350, 10),callback=lambda: MainUI.change_textInButton("ButtonA", next(myIterator1)))
MainUI.add_toast("DemoToast", "This is a demo toast!")
MainUI.add_textInContextArea("text1", "This is a demo text in text area.\nYou can add multiple lines of text here.\nEnjoy CV2SUI!", whichArea="textArea")
img1 = cv2.imread("./demoImages/Test1.png")
MainUI.add_imgInContextArea("img1", img1, whichArea="imgArea")
MainUI.add_textBar("DemoTextBar", positionXY=(500,100))
img2 = cv2.imread("./dermoImages/test2.jpg")
MainUI.show()