Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Python_超人
宇宙模拟器
提交
2dc3a808
宇宙模拟器
项目概览
Python_超人
/
宇宙模拟器
通知
19
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
宇宙模拟器
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2dc3a808
编写于
11月 27, 2023
作者:
三月三net
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python超人-宇宙模拟器
上级
53ccb51a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
23 addition
and
5 deletion
+23
-5
sim_scenes/fiction/earth_orbit_stopped.py
sim_scenes/fiction/earth_orbit_stopped.py
+1
-1
tools/sim_video_cap.py
tools/sim_video_cap.py
+22
-4
未找到文件。
sim_scenes/fiction/earth_orbit_stopped.py
浏览文件 @
2dc3a808
...
@@ -259,7 +259,7 @@ if __name__ == '__main__':
...
@@ -259,7 +259,7 @@ if __name__ == '__main__':
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
# position = 左-右+、上+下-、前+后-
# position=(0, 0, 0) 的位置是站在地球视角,可以观看月相变化的过程
# position=(0, 0, 0) 的位置是站在地球视角,可以观看月相变化的过程
ursina_run
(
sim
.
bodies
,
SECONDS_PER_DAY
,
position
=
(
0
,
0.0001
*
AU
,
-
0.8
*
AU
),
ursina_run
(
sim
.
bodies
,
SECONDS_PER_DAY
/
2.5
,
position
=
(
0
,
0.0001
*
AU
,
-
0.8
*
AU
),
show_camera_info
=
False
,
show_camera_info
=
False
,
show_control_info
=
False
,
show_control_info
=
False
,
show_timer
=
True
,
show_timer
=
True
,
...
...
tools/sim_video_cap.py
浏览文件 @
2dc3a808
...
@@ -82,9 +82,10 @@ def wait_sec(sec=0):
...
@@ -82,9 +82,10 @@ def wait_sec(sec=0):
return
return
def
sim_window_screen_shot
(
wait_ses
=-
1
):
def
sim_window_screen_shot
(
wait_ses
=-
1
,
retry_times
=
3
):
times
=
wait_ses
*
100
times
=
wait_ses
*
100
while
True
:
while
True
:
handle
,
desktop_dc
,
img_dc
,
img
=
None
,
None
,
None
,
None
handle
=
get_window_handle
()
handle
=
get_window_handle
()
if
handle
>
0
:
if
handle
>
0
:
desktop_dc
=
win32gui
.
GetWindowDC
(
handle
)
desktop_dc
=
win32gui
.
GetWindowDC
(
handle
)
...
@@ -93,7 +94,14 @@ def sim_window_screen_shot(wait_ses=-1):
...
@@ -93,7 +94,14 @@ def sim_window_screen_shot(wait_ses=-1):
img
=
screen_shot
(
img_dc
)
img
=
screen_shot
(
img_dc
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
"ERROR:"
,
str
(
e
))
print
(
"ERROR:"
,
str
(
e
))
print
(
"handle"
,
handle
)
print
(
"desktop_dc"
,
desktop_dc
)
print
(
"img_dc"
,
img_dc
)
print
(
"img"
,
img
)
traceback
.
print_exc
()
traceback
.
print_exc
()
if
retry_times
>
0
:
print
(
"retry_times"
,
retry_times
)
return
sim_window_screen_shot
(
wait_ses
,
retry_times
-
1
)
return
None
return
None
return
img
return
img
if
wait_ses
<
0
:
if
wait_ses
<
0
:
...
@@ -118,6 +126,11 @@ def create_video(args, height, width):
...
@@ -118,6 +126,11 @@ def create_video(args, height, width):
# print(image.size) # 结果为(822,694),这里注意Image输出的结果先显示列数,后显示行数
# print(image.size) # 结果为(822,694),这里注意Image输出的结果先显示列数,后显示行数
# image.show()
# image.show()
def
get_current_time
():
import
datetime
current_time
=
datetime
.
datetime
.
now
()
return
current_time
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
get_args
()
args
=
get_args
()
...
@@ -135,11 +148,16 @@ if __name__ == '__main__':
...
@@ -135,11 +148,16 @@ if __name__ == '__main__':
# show_image(img)
# show_image(img)
video
=
create_video
(
args
,
img
.
shape
[
0
],
img
.
shape
[
1
])
video
=
create_video
(
args
,
img
.
shape
[
0
],
img
.
shape
[
1
])
imageNum
=
0
imageNum
=
0
print
(
"开始录屏"
)
# import datetime
#
# current_time = datetime.datetime.now()
# # print("当前时间:", current_time)
print
(
"开始录屏时间:"
,
get_current_time
())
while
True
:
while
True
:
img
=
sim_window_screen_shot
()
img
=
sim_window_screen_shot
()
if
img
is
None
:
if
img
is
None
:
print
(
"
\n
模拟器窗口已关闭,退出录屏
"
)
print
(
"
\n
模拟器窗口已关闭,退出录屏
时间:"
,
get_current_time
()
)
break
break
# if is_blank_screen(img):
# if is_blank_screen(img):
...
@@ -164,5 +182,5 @@ if __name__ == '__main__':
...
@@ -164,5 +182,5 @@ if __name__ == '__main__':
video
.
release
()
video
.
release
()
cv2
.
destroyAllWindows
()
cv2
.
destroyAllWindows
()
# crop('video.mp4')
# crop('video.mp4')
print
(
"视频保存完成
"
)
print
(
"视频保存完成
时间:"
,
get_current_time
()
)
print
(
args
.
save_name
)
print
(
args
.
save_name
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录