File tree Expand file tree Collapse file tree 6 files changed +74
-0
lines changed Expand file tree Collapse file tree 6 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Python 代码实例
2
+
3
+ - [ pywebview] ( https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/pywebview-flask ) : 不用 GUI,照样实现图形界面
2
4
- [ mazegame] ( https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/mazegame ) : 程序员陪孩子,你还可以这么干……
3
5
- [ meta] ( https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/meta ) : 几行代码,撸了个 元宇宙?!
4
6
- [ fake-thread] ( https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/fake-thread ) : Python 多线程居然是 —— 假的?
Original file line number Diff line number Diff line change
1
+ import os
2
+ import sys
3
+ from flask import Flask , render_template
4
+
5
+ app = Flask (__name__ )
6
+ @app .route ('/' )
7
+ def index (): # 定义根目录处理器
8
+ return render_template ('index.html' )
9
+
10
+ @app .route ('/detail' )
11
+ def detail ():
12
+ return render_template ('detail.html' )
13
+
14
+ if __name__ == '__main__' :
15
+ app .run () # 启动服务
Original file line number Diff line number Diff line change
1
+ import webview
2
+ from contextlib import redirect_stdout
3
+ from io import StringIO
4
+ from app import app
5
+
6
+ if __name__ == '__main__' :
7
+ window = webview .create_window ('Pywebview' , app )
8
+ webview .start ()
Original file line number Diff line number Diff line change
1
+ altgraph == 0.17.2
2
+ click == 8.0.3
3
+ colorama == 0.4.4
4
+ Flask == 2.0.2
5
+ future == 0.18.2
6
+ itsdangerous == 2.0.1
7
+ Jinja2 == 3.0.3
8
+ MarkupSafe == 2.0.1
9
+ pefile == 2021.9.3
10
+ proxy-tools == 0.1.0
11
+ pycparser == 2.21
12
+ pyinstaller == 4.8
13
+ pyinstaller-hooks-contrib == 2021.5
14
+ pythonnet == 2.5.2
15
+ pywebview == 3.5
16
+ pywin32-ctypes == 0.2.0
17
+ Werkzeug == 2.0.2
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8
+ < title > 详情</ title >
9
+ </ head >
10
+
11
+ < body >
12
+ < h1 > 这是详情页</ h1 >
13
+ < div > < a href ="/ "> 返回首页</ a > </ div >
14
+ </ body >
15
+
16
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8
+ < title > Hello Pywebview</ title >
9
+ </ head >
10
+
11
+ < body >
12
+ < h1 > Hello Pywebview</ h1 >
13
+ < div > < a href ="/detail "> 查看详情</ a > </ div >
14
+ </ body >
15
+
16
+ </ html >
You can’t perform that action at this time.
0 commit comments