Skip to main content

web font picker flask extension

Project description

flask_fontpicker

A Flask extension for Jquery-ui google font picker, it makes adding and customizing multiple font pickers simpler and less time consuming.

Install:

- With pip

  • pip install Flask-Fontpicker

- From the source:

  • git clone https://github.com/mrf345/flask_fontpicker.git
  • cd flask_fontpicker
  • python setup.py install

Setup:

- Inside Flask app:

from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_fontpicker import fontpicker

app = Flask(__name__)
Bootstrap(app)
fontpicker(app)

- Inside jinja template:

{% extends 'bootstrap/base.html' %}
{% block scripts %}
  {{ super() }}
  {{ fontpicker.loader() }} {# to load jQuery-ui #}
  {{ fontpicker.picker(ids=["#dp"]) }}
{% endblock %}
{% block content %}
  <form class="verticalform">
    <input type="text" id="dp" class="form-control" />
  </form>
{% endblock %}

Settings:

- Options:

The accepted arguments to be passed to the fontpicker.picker() function are as follow:

def picker(self, ids=["#fontpicker"], # list of identifiers will be passed to Jquery to select element
                  families='["Droid Sans", "Roboto", "Roboto Condensed", "Signika"]',
                  # list of the font families to be displayed
                  loadAll='true', # to load all the selected fonts
                  default='Roboto', # default font to load at first
                  urlCss='', # to load fonts with local css file
                  spaceChar='+'): # spacing character used in local css file

- Local source:

by default the extension will load Jquery-ui plugin from a remote CDN. Although you can configure that to be locally through passing a list of .js and .css files into the fontpicker module like such:

fontpicker(app=app, local=[
  'static/js/jquery-ui.js', 
  'static/css/jquery-ui.css', 
  'static/js/webfont.js',
  'static/css/webfont.select.css',
  'static/js/webfont.select.js'
  ])

The order in-which the items of list are passed is not of importance, it will be auto detected via file extension

Credit:

  • Fontpicker: jQuery-ui web google font picker extension.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_fontpicker-0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_fontpicker-0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file flask_fontpicker-0.3.tar.gz.

File metadata

  • Download URL: flask_fontpicker-0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for flask_fontpicker-0.3.tar.gz
Algorithm Hash digest
SHA256 4d52c0af97e5c2ef6e083494b59340122761b8a7881d5297d059453a7996bd9a
MD5 3a79203078f8215bdfc20c647a7e36fc
BLAKE2b-256 39624dfd3ebff9e6b49fac6268b26f316774566a2a8aec3855a90c8db114c14a

See more details on using hashes here.

File details

Details for the file flask_fontpicker-0.3-py3-none-any.whl.

File metadata

  • Download URL: flask_fontpicker-0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for flask_fontpicker-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a52921c912e1ca9fc16be37d7acd108ee8007935539ebef0597c0de641715446
MD5 8379c59ef55a65c31b25e4a3ec866fb2
BLAKE2b-256 397e24bbcc8f0e4fc8f1e96c77426ce124f360052563e0ab7fccf86da5bb96ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page