Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b8b595

Browse files
committed
python pywebview
1 parent bb08ea1 commit 9b8b595

File tree

6 files changed

+74
-0
lines changed

6 files changed

+74
-0
lines changed

‎taiyangxue/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Python 代码实例
2+
3+
- [pywebview](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/pywebview-flask) : 不用 GUI,照样实现图形界面
24
- [mazegame](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/mazegame) : 程序员陪孩子,你还可以这么干......
35
- [meta](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/meta) : 几行代码,撸了个 元宇宙?!
46
- [fake-thread](https://github.com/JustDoPython/python-examples/tree/master/taiyangxue/fake-thread) : Python 多线程居然是 —— 假的?

‎taiyangxue/pywebview-flask/app.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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() # 启动服务

‎taiyangxue/pywebview-flask/main.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /