Create launchable HTML form windows using a Markdown-like language
Project description
Checkmark
Checkmark lets you quickly and easily set up a way for you or any other user to submit data to your program through an HTML form. Using a Markdown-like document, you can specify a plethora of form elements.
Form elements
Example
from checkmark import MarkupForm
document = """
: Username
> [Username](username "Ex. @user:domain.tld")
: Password
> [Password](password "Choose something not too simple.")
"""
style = """
body {
background-color: rgb(31, 31, 56);
color: white;
font-family: monospace;
}
"""
window = MarkupForm('My Form', document, style, 'Save')
window.launch(close_on_submit=True, min_size(200, 400))
print('[b green]Submitted data:[/b green]')
print(window.form.items())
You can try it out with the example below.
## Account
: Username
> [Username](username "Ex. @user:domain.tld")
: Password
> [Password](password "Choose something not too simple.")
: Email address
> [Ex. user@domain.tld](email "So that you can confirm your account.")
+ [x] [Sign me up to the newsletter](newsletter)
>> [My hobbies are ...](hobbies "What do you like to do during your free time?")
## [Message layout](layout)
* [ ] [IRC](irc)
* [x] [Modern](modern)
* [ ] [Message bubbles](bubbles)
## [Language](language)
- [x] [Swedish](se)
- [ ] [English](en)
- [ ] [French](fr)
Rules
Every element has a prefix specification followed by text. The text can be written either plainly or as a Markdown link. Written plainly, URL and title will be generated from the text.
Link
The title is always used as the title
argument for any element for which it is specified.
[Text](url "Title.")
# This is my text.
is equivalent to
# [This is my text.](This-is-my-text "")
Headings
The standard 6 headings can be made just as in Markdown.
## Heading 2
Label
Labels are simply aesthetic and don't affect the functionality of the form.
: [Super Label](best-label)
Text & TextArea
Text
uses one >
as prefix and TextArea
uses two.
The text of the link is used as the placeholder
argument.
Text
> [Username](username "Ex. @user:domain.tld")
TextArea
>> [My hobbies are ...](hobbies "What do you like to do during your free time?")
Selections
All these types of elements are defined using list items.
- Checkboxes using
+
as prefix. - Radio buttons using
*
as prefix. - Dropdown options using
-
as prefix.
Checkboxes
+ [x] [I understand how selections work.](understood)
Radio buttons & Dropdown options
Both types require that a heading precedes them. It's used to specify in which variable the selected value is to be stored.
The URL of an option is used as the value.
Radio buttons
## [Message layout](layout)
* [ ] [IRC](irc)
* [x] [Modern](modern)
* [ ] [Message bubbles](bubbles)
Dropdown options
## [Language](language)
- [x] [Swedish](se)
- [ ] [English](en)
- [ ] [French](fr)
Paragraph
Any line or lines that aren't matched to another rule is stored as a paragraph.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for checkmark-1.0.0.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd0fe1594c1da0bdb30b4b24539c1a441981f8a611b879460ed08b94316e7f72 |
|
MD5 | 9e83a35eff8aa624b6809bf289a6f096 |
|
BLAKE2b-256 | 3251c43c3cdec7f4929526eac199f88af30961b0e9de4301bf410daa68218a1a |