白桦的天空

第一次的心动,永远的心痛!
随笔 - 349, 文章 - 15, 评论 - 203, 阅读 - 25万
  首页  :: 新随笔  :: 联系 :: 管理
< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

pygame和pywebview配合做界面

Posted on   白桦的天空  阅读(65)  评论(0编辑  收藏  举报
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
import pygame
import sys
from multiprocessing import Process, Value
import multiprocessing
import webview
import time
import ctypes
 
 
def hide_show(window, is_exit):
    window.hide()
    time.sleep(5)
    # window.toggle_fullscreen()
    window.show()
    is_exit.value = True
 
 
def test2(is_exit):
    window = webview.create_window('Full-screen window',
                                   'https://www.ifeng.com/',
                                   fullscreen=True)
    # window.on_top = True
    webview.start(hide_show, (window, is_exit), gui='cef')
 
 
if __name__ == '__main__':
    is_exit = multiprocessing.Manager().Value(ctypes.c_bool, False)
    pygame.init()
    # screen = pygame.display.set_mode((600, 400))
    screen = pygame.display.set_mode((0, 0), flags=pygame.FULLSCREEN)
    pygame.display.set_caption("loading...")
 
    p = Process(target=test2, args=(is_exit,))
    p.start()
 
    while not is_exit.value:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
        pygame.display.update()
    pygame.quit()
    sys.exit()

  

相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示