navigate Logo

Getting Started

  • Quick Start Guide
  • Software Installation
  • I Want To…

User Guide

  • Supported Hardware
  • Supported File Formats
  • User Interface Walkthrough
  • Setting Up A Microscope
  • Acquiring Data
  • Case Studies

Development

  • Contributing Guidelines
  • Developer Install
  • Software Architecture
  • Feature Container
  • REST-API
  • Plugin Architecture

Troubleshooting & Known Issues

  • Troubleshooting
  • Known Issues

Plugins

  • navigate Plugin Template
  • navigate Confocal Projection
  • navigate at Scale
  • navigate Constant Velocity Acquisition
  • navigate MMCore
  • navigate ilastik Server
  • navigate Photoactivation

Reference

  • Implemented Microscopes
  • Software API
    • navigate.config
    • navigate.controller
    • navigate.log_files
    • navigate.model
    • navigate.tools
    • navigate.view
      • navigate.view.configurator_application_window
      • navigate.view.custom_widgets
        • navigate.view.custom_widgets.ArrowLabel
        • navigate.view.custom_widgets.CollapsibleFrame
        • navigate.view.custom_widgets.DockableNotebook
        • navigate.view.custom_widgets.LabelInputWidgetFactory
        • navigate.view.custom_widgets.common
        • navigate.view.custom_widgets.hover
        • navigate.view.custom_widgets.popup
        • navigate.view.custom_widgets.scrollbars
        • navigate.view.custom_widgets.validation
      • navigate.view.main_application_window
      • navigate.view.main_window_content
      • navigate.view.popups
      • navigate.view.splash_screen
navigate
  • Software API
  • navigate.view
  • navigate.view.custom_widgets
  • navigate.view.custom_widgets.validation
  • navigate.view.custom_widgets.validation.REGEX_DICT
  • View page source

navigate.view.custom_widgets.validation.REGEX_DICT

navigate.view.custom_widgets.validation.REGEX_DICT = {'float': '(^-?$)|(^-?[0-9]+\\.?[0-9]*$)', 'float_nonnegative': '(^$)|(^[0-9]+\\.?[0-9]*$)', 'int': '^-?[0-9]*$', 'int_nonnegative': '^[0-9]*$'}

Base design courtesy: Learning Path: Python GUI Programming - A Complete Reference Guide by Alan D. Moore and B. M. Harwani

The below classes take advantage of multiple inheritance to achieve validation.

Validation Events: none, focusin, focusout, focus, key, all - Focus is whether user is using widget - Key is when user is typing keystrokes

Substitution Codes for validation in tkinter: %P, %s, %i, %S, %v, %V, %W, %d - %P = proposed value from user - %s = value currently in field - %i = index of text being edited. String - %S = text being inserted or deleted - %v = widgets validate value - %V = event that triggered validation - %W = widgets name in TK as string - %d = code that indicates action attempted. 0 for delete, 1 for insert, -1 for other.

String Tkinter Validation process: - validate sets the event that triggers callback - validatecommand takes in command that determines if data is valid - invalidcommand runs command given if validatecommand is False

A python callable is passed to a .register function for the widget def someFun(): do something def otherFun(): do something widget = ttk.Entry() wrapped_function = widget.register(someFun) other_function = widget.register(otherFun) validation_function = (wrapped_function, ‘%P’) # Can use any amount of substitution codes above to pass in various data invalid = (other_function, ‘%P’, ‘%s’) widget.config(

validate=’all’, validatecommand=validation_function with args, invalidcommand=invalid_function with args

)

Previous Next

© Copyright 2025, Dean Lab, UT Southwestern Medical Center.