Skip to content

Commit 4c7401b

Browse files
committed
optimize show
1 parent b384701 commit 4c7401b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

projects/app_rtmp_live/main.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
str_btn_tips = 'touch to scan qrcode'
2121
str_no_url_tips1 = 'Get RTMP server address from live platforms'
2222
str_no_url_tips2 = 'Generate QRCode with server address'
23-
str_scan_tips1 = '1. Get RTMP server addr from live platforms'
23+
str_scan_tips1 = '1. Get RTMP server addr from live platform'
2424
str_scan_tips2 = ' format like rtmp://xxx.com/app/stream'
2525
str_scan_tips3 = '2. Generate QRCode with server addr, scan'
2626

@@ -92,8 +92,8 @@ def parse_url(url):
9292

9393
if len(global_url) == 0:
9494
color = image.Color.from_rgb(0x6e, 0x6e, 0x6e)
95-
base_img.draw_string(base_img.width()//2 - image.string_size(str_no_url_tips1, 2).width()//2, int(base_img.height() * 0.15), str_no_url_tips1, color, 1.5)
96-
base_img.draw_string(base_img.width()//2 - image.string_size(str_no_url_tips2, 1.5).width()//2, int(base_img.height() * 0.15) + str_height_2 + 10, str_no_url_tips2, color, 1.5)
95+
base_img.draw_string(base_img.width()//2 - image.string_size(str_no_url_tips1, 1.5).width()//2, img_exit.height() + 15 , str_no_url_tips1, color, 1.5)
96+
base_img.draw_string(base_img.width()//2 - image.string_size(str_no_url_tips2, 1.5).width()//2, img_exit.height() + 15 + str_height_2 + 10, str_no_url_tips2, color, 1.5)
9797
box = [base_img.width()//2-img_scan.width()//2, base_img.height()//2-50, 100, 100]
9898
if touch_box(t, box):
9999
base_img.draw_image(box[0], box[1], img_scan)
@@ -169,9 +169,9 @@ def parse_url(url):
169169
else:
170170
img.draw_image(box[0], box[1], img_exit)
171171

172-
img.draw_string(20, int(img.height() * 0.75), str_scan_tips1, image.Color.from_rgb(0x6e, 0x6e, 0x6e), 2)
173-
img.draw_string(20, int(img.height() * 0.75) + str_height_2 + 10, str_scan_tips2, image.Color.from_rgb(0x6e, 0x6e, 0x6e), 2)
174-
img.draw_string(20, int(img.height() * 0.75) + (str_height_2 + 10) * 2, str_scan_tips3, image.Color.from_rgb(0x6e, 0x6e, 0x6e), 2)
172+
img.draw_string(0, int(img.height() - (str_height_2 * 3 + 3 * 4)), str_scan_tips1, image.Color.from_rgb(0x6e, 0x6e, 0x6e), 2)
173+
img.draw_string(0, int(img.height() - (str_height_2 * 3 + 3 * 4)) + str_height_2 + 4, str_scan_tips2, image.Color.from_rgb(0x6e, 0x6e, 0x6e), 2)
174+
img.draw_string(0, int(img.height() - (str_height_2 * 3 + 3 * 4)) + str_height_2 * 2 + 4*2, str_scan_tips3, image.Color.from_rgb(0x6e, 0x6e, 0x6e), 2)
175175
disp.show(img)
176176
del cam
177177
cam = None

0 commit comments

Comments
 (0)