PyGui

0
год назад
год назад
год назад
год назад
год назад
README.md

DearPyGui Application

A simple GUI application built with DearPyGui that demonstrates file dialog functionality with multiple fallback methods.

Features

  • Clean, modular code structure
  • Multiple file dialog implementations with fallbacks
  • Configurable through external configuration file
  • Proper error handling and logging

Configuration

The application is fully configurable through a JSON configuration file. By default, the application looks for a

config.json
file in the project root directory. If this file doesn't exist, a default configuration file will be created automatically.

Configuration Options

  • APP_NAME: The name of the application
  • VIEWPORT: Settings for the application viewport (window)
    • title: The title of the application window
    • width: The width of the application window
    • height: The height of the application window
    • x_pos: The x position of the application window
    • y_pos: The y position of the application window
  • MAIN_WINDOW: Settings for the main window
    • label: The label of the main window
    • tag: The tag of the main window (used for identification)
  • FONT_SIZE: The size of the font used in the application
  • FONT_PATHS: A list of paths to font files to try to load
  • UI_TEXT: Text strings used in the UI
    • no_file_selected: Text shown when no file is selected
    • selected_file_format: Format string for showing the selected file
  • MENU: Labels for menu items
    • file_menu_label: Label for the File menu
    • open_menu_item: Label for the Open menu item
    • exit_menu_item: Label for the Exit menu item
  • WIN32_DIALOG: Settings for the Win32 file dialog
    • filter_spec: Filter specification for file types
    • custom_filter: Custom filter for file types
    • title: Title of the file dialog
  • POWERSHELL_DIALOG: Settings for the PowerShell file dialog
    • filter: Filter for file types
    • title: Title of the file dialog
  • DPG_DIALOG: Settings for the custom DearPyGui file dialog
    • label: Label of the dialog window
    • width: Width of the dialog window
    • height: Height of the dialog window
    • tag: Tag of the dialog window
    • text: Text shown in the dialog
    • input_label: Label for the input field
    • input_width: Width of the input field
    • input_tag: Tag of the input field
    • open_button: Label for the Open button
    • cancel_button: Label for the Cancel button
    • spacer_width: Width of the spacer between buttons

Customizing the Configuration

To customize the application, you can:

  1. Copy the
    config.json.sample
    file to
    config.json
  2. Edit the
    config.json
    file to change the configuration options
  3. Run the application

The application will automatically load the configuration from the

config.json
file.

Project Structure

  • main.py: Entry point for the application
  • pygui_app/: Package containing the application modules
    • init.py: Package initialization
    • app.py: Main application class
    • config.py: Configuration module
    • file_dialog.py: File dialog handling
    • utils.py: Utility functions

Running the Application

Requirements

  • Python 3.6+
  • DearPyGui
  • pywin32 (optional, for Win32 file dialog)