Skip to main content

Interactive file selection prompts using Qt5.

Project description

pyqt5-file-dialogs

Interactive file selection prompts using Qt5.

Usage

import json
from pathlib import Path

from pyqt5filedialogs import get_open_filepath, get_save_filepath

def read_data():
    """
    Load data from a JSON file selected by the user.
    """
    filepath = get_open_filepath(caption="Select a JSON data file.")
    with open(filepath, 'r') as f:
        data = json.load(f)
    return data

def export_config():
    """
    Export a config `dict` object to a JSON file selected by the user.
    """
    config = {
        'preferences': {
            'theme': 'light',
            'font_size': 16,
            'font_family': 'Roboto',
        }
    }

    config_dir = Path.home().joinpath('.config', 'myapp')
    if not config_dir.exists():
        config_dir.mkdir(parents=True)
    filepath = get_save_filepath(filter='JSON Files (*.json)')
    with open(filepath, 'w') as f:
        json.dump(config, f)
    return filepath.stat().st_size

Installation

Install with pip.

$ pip install pyqt5filedialogs

Dependencies

  • PySide2 - Qt5 bindings for Python.

License

This project is licensed under the MIT license.

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

pyqt5-file-dialogs-1.0.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

pyqt5_file_dialogs-1.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pyqt5-file-dialogs-1.0.1.tar.gz.

File metadata

  • Download URL: pyqt5-file-dialogs-1.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.2

File hashes

Hashes for pyqt5-file-dialogs-1.0.1.tar.gz
Algorithm Hash digest
SHA256 89460cdb27b11e3752b23564ad12e1964d8d9cba781575f784175e17a0c35555
MD5 a4dc8ca4f610562fc988a3c1ee1a483e
BLAKE2b-256 caf17331748b5f451caf196ce599956e21b8a0a2169534f17203849a3fd9556e

See more details on using hashes here.

File details

Details for the file pyqt5_file_dialogs-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyqt5_file_dialogs-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.2

File hashes

Hashes for pyqt5_file_dialogs-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 017c4c5efbe8fda351a8fca328b9b418d18cb0759125e13c77250706216e2a15
MD5 7158757383edaf1381518cb6d9028854
BLAKE2b-256 70b424cf715a3e96425dd37b118016d4a6fd7bb9b08c6b46e525f35b36fcc009

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