<!-- markdownlint-disable MD033 -->
# Scripted Forms [](https://travis-ci.org/SimonBiggs/scriptedforms) [](https://mybinder.org/v2/gh/SimonBiggs/scriptedforms-examples/master)
Making GUIs easy for everyone on your team.
The primary benefit is that front ends for Python code become easily accessible
to everyone on your team. Easy to use, easy to update, easy to extend, and easy
to understand.
* Quickly create live-update GUIs for Python packages using Markdown and a few custom HTML elements.
* Just write in markdown + variables / UI types
* Based on Jupyter
## Quick start
If you would like to take scriptedforms for a spin you will need Python. If you don't have Python on your computer I recommend using Anaconda Python (https://www.anaconda.com/download/).
After you have python you can then install ScriptedForms by typing the following into a terminal (or command prompt):
```bash
pip install scriptedforms
```
Then create a markdown file called `quick-start.md` using any plaintext editor (such as
[Visual Studio Code](https://code.visualstudio.com/)) within your terminal's current directory.
Make the contents be the following:
~~~markdown
# An example
<section-live>
<variable-string>your_name</variable-string>
```python
print('Hello {}!'.format(your_name))
```
</section-live>
~~~
Then run the following in your terminal
```bash
scriptedforms quick-start.md
```
If everything worked, a Scripted Form should open within your default browser.
You should be able to type your name into the form and see the code field live
update with each key stroke:
<p align="center">
<img src="./images/quick-start.png">
</p>
Now within `quick-start.md` edit the markdown file by changing
```markdown
# An example
```
to
```markdown
# The form updates when I change it
```
and then press save. The form in the browser should then update to match what
you just wrote.
### Plotting and slider example
If you want to be a bit more adventurous see what happens if you add the
following to the end of the your `quick-start.md` file (or any other
ScriptedForm):
~~~markdown
#### Example slider use case
Using the slider and live sections combined with matplotlib plots you can
produce utilities like the following:
<section-start>
```python
t = np.linspace(-2*np.pi, 2*np.pi, 500)
omega = np.ones(2)
```
</section-start>
<section-live>
Angular frequencies ($\omega$):
<variable-slider name="$\omega [0]$" min="0" max="6" step="0.1">omega[0]</variable-slider>
<variable-slider name="$\omega [1]$" min="0" max="6" step="0.1">omega[1]</variable-slider>
```python
plt.figure(figsize=(5*1.618,5))
oscillation = np.sin(t[:, np.newaxis] * omega[np.newaxis, :])
summation = np.sum(oscillation, axis=1)
plt.plot(t, oscillation)
plt.plot(t, summation)
plt.xlim([-2*np.pi, 2*np.pi])
plt.ylim([-2.4, 2.4])
plt.title('Two sin curves and their summation')
plt.legend([
r'$\omega [0] = {0:0.1f}$'.format(omega[0]),
r'$\omega [1] = {0:0.1f}$'.format(omega[1]),
'Summation'], loc='upper right')
plt.xlabel('time (seconds)')
plt.ylabel(r'$sin(\omega \times t)$');
```
</section-live>
~~~
This should produce what is seen in the following screenshot:
<a href="https://mybinder.org/v2/gh/SimonBiggs/scriptedforms-examples/master">
<p align="center">
<img src="./images/detailed.png">
</p>
</a>
[Click here](https://mybinder.org/v2/gh/SimonBiggs/scriptedforms-examples/master) to see a live version of this example on mybinder.org. This will run slower online on that server than when you are using it locally.
### More features
For a markdown file that presents the majority of the features of scriptedforms
see
[detailed.md](https://raw.githubusercontent.com/SimonBiggs/scriptedforms/master/example/example/detailed.md).
Try writing some of the contents of that file into a ScriptedForm to see how
they work.
## Security notice
Be aware that ScriptedForms uses the [Jupyter Notebook Server security model](http://jupyter-notebook.readthedocs.io/en/stable/security.html#security-in-the-jupyter-notebook-server). When a user has access to the forms via the localhost web interface, should they have sufficient know how, they also have the ability to run arbitrary Python code without limitations.
By default only users on the local machine will be able to access the Jupyter Notebook Server which means if you trust a user to run code on their own machine then allowing them to use ScriptedForms will not cause issue. Only override these default settings if you understand and accept the security implications.
Furthermore do not run a scripted form unless you trust its origin. Given the reactive nature of ScriptedForms, code within the markdown template can run on form opening, as well as during usage.
## Example that can be used as a template for deployment
This is designed to be used as a quick and easy GUI for python packages. An
example package that creates a console script that then uses scriptedforms to
boot up a GUI can be found within the [example](./example) directory.
Within the [`README.md`](./example/README.md) file of that directory there is an
explanation of how you might go about deploying your utility with its new GUI.
## [Optional] Installing the Jupyter Server extension
ScriptedForms can also be installed as a [Jupyter Server extension](http://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#Enable-a-Server-Extension). Eventually this should allow the use of ScriptedForms with tools such as [JupyterHub](http://jupyterhub.readthedocs.io/en/latest/). This part of ScriptedForms is still a work in progress but if you want to give it a try then make sure you have at least version `0.5.15` of ScriptedForms and then run:
```bash
jupyter serverextension enable --py scriptedforms
```
Then to start ScriptedForms using its Jupyter Server extension run the following
```bash
jupyter notebook --NotebookApp.default_url=/scriptedforms/use/quick-start.md
```
## [Advanced users only] Installing scriptedforms from the GitHub source
The majority of users will not need to pay attention to this section.
For those who wish to build scriptedforms from the source provided within this
repository, instead of using pypi, the javascript bundle will need to be built.
To do this you will need to
[install `yarn`](https://yarnpkg.com/lang/en/docs/install/) and then run the
following in the
[directory containing the `package.json` file](./scriptedforms):
```bash
yarn
yarn build
yarn pip:install
```
This will install the node packages, build the javascript files and then run
`pip install -e .` to install the python package.
## Software license agreement
Scripted Forms -- Making GUIs easy for everyone on your team.
Copyright (C) 2017 Simon Biggs
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version (the "AGPL-3.0+").
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License and the additional terms for more
details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
ADDITIONAL TERMS are also included as allowed by Section 7 of the GNU
Affrero General Public License. These aditional terms are Sections 1, 5,
6, 7, 8, and 9 from the Apache License, Version 2.0 (the "Apache-2.0")
where all references to the definition "License" are instead defined to
mean the AGPL-3.0+.
You should have received a copy of the Apache-2.0 along with this
program. If not, see <
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:scriptedforms-0.8.0.dev2.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论


























收起资源包目录





































































































共 150 条
- 1
- 2
资源评论


挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+

下载权益

C知道特权

VIP文章

课程特权

开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 有清华大学2月最新汇报ppt及录音,下载后可发送全套
- esp32单片机,检测马达转速项目提供源码下载
- 前端框架-Vue2初体验
- 三菱FX3U PLC与E740变频器Modbus RTU通讯案例:启停控制、频率调节及参数读取的编程实现,三菱FX3U PLC与变频器Modbus RTU通讯控制案例:实现启停、频率设定与数据读取功能
- DeepSeek大模型安装助手简介
- 机器学习课程设计基于Python的实现自动化垃圾邮件过滤项目源代码+已标记数据集
- AI推理模型DeepSeek-R1网页端&API使用指南:性能特点及实际应用案例解析
- 毕业设计基于Python的Django-html基于深度学习的音乐推荐方法研究系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- iozone自动化测试脚本
- PyQt5+Yolov8车牌检测系统
- 毕业设计基于Python的Django-html基于循环神经网络的情感分类系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- iozone3-507工具
- csdn积分获取,看看能不能获取积分
- usb通信-Linux-遍历usb
- Go语言学习指南:从入门到精通全面掌握后端开发高效语言
- 雷达测距测速成像+线性调频连续波雷达+仿真分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
