Skip to content

V0.28 - NumpyGUI, modern & dual-pane ๐Ÿ’ป

Choose a tag to compare

@Ariel4545 Ariel4545 released this 06 Jan 14:02
· 10 commits to main since this release
2164738

Patch Notes: NumpyGui Update

๐ŸŒŸ Top-Level Summary

This update transforms NumpyGui from a menu-driven, single-window application into a modern, dual-pane interface with persistent state management. It introduces a tabbed operations panel, inline controls for complex functions, and significantly refactors the codebase for maintainability and stability.


๐Ÿš€ New Features

๐Ÿ’พ Persistent State Management

  • New StateManager Class: Implemented to handle saving and loading settings via numpygui_state.json.
  • Persisted Settings:
    • Theme: Remembers "Light" vs "Dark" mode preference across restarts.
    • View Configuration: Remembers the visibility state of the Operations Tabs and Menu Bar.

๐Ÿ—‚๏ธ Tabbed Operations Interface

  • Side Panel: Added a CTkTabview on the right side of the window, organizing operations into 10 distinct categories (Arithmetic, Rounding, Trig, Stats, etc.).
  • Dynamic Resizing:
    • Compact Mode: Width 725px (Tabs hidden).
    • Expanded Mode: Width 1050px (Tabs visible).
  • View Control: Added a View menu to toggle the Side Tabs and Top Menus independently.

๐Ÿงฎ Calculator Grid (Arithmetic Tab)

  • Visual Update: Replaced the list of text-based arithmetic commands with a Calculator-style Grid.
  • Symbols: Uses mathematical symbols (+, -, ร—, รท, xยฒ, โˆš, |x|) for faster recognition.

๐Ÿ› ๏ธ Functional Overhaul: Inline Controls

Many operations that previously required popup windows (CTkToplevel) or lacked parameter inputs have been upgraded to use Inline Controls directly within the tabs.

Feature Old Behavior New Behavior
Data Filtering Opened a popup window for "Size" and "Parity". Inline: CTkEntry for threshold, CTkSegmentedButton for >/< and Even/Odd.
Search Opened a popup window. Inline: CTkEntry to input search value + "Find" button.
Linspace Called linspace(array) (often incorrect usage). Inline Generator: Inputs for Start, Stop, and Count.
Random Int Used array data as bounds. Inline Generator: Inputs for Min, Max, and Count.
Rounding Always rounded to integer. Precision Control: Added input for Decimal Places.
Log/Power Standard bases only ($e, 10, 2$). Custom Base: Added input to calculate $log_b(x)$ or $b^x$.
Constants Menu items inserted values. Dropdown: CTkOptionMenu to select constant + "Insert" button.
Num Systems Separate menu items. Selector: CTkSegmentedButton (Bin/Oct/Hex) + Convert button.

๐ŸŽจ UI/UX Improvements

Layout & Styling

  • Grid System: Migrated main layout from pack() to grid() to support the split-pane design.
  • Input Frame: Grouped the two main input textboxes into a transparent input_frame for better alignment.
  • Widget Upgrade: Replaced standard tkinter.Text with customtkinter.CTkTextbox.
    • Note: Explicitly enabled undo=True on the underlying widget to maintain previous functionality.

Grouping

  • Trigonometry: Functions are now visually grouped: Standard, Conversion, Hyperbolic, Inverse Hyperbolic.
  • Statistics: Grouped into Central Tendency, Extremes, and Dispersion.

๐Ÿ’ป Code Refactoring & Quality

Architecture

  • Modular Construction: The __init__ method was monolithic. It has been refactored into specific helper methods for each tab:
    • create_arithmetic_widgets
    • create_data_widgets
    • create_calculus_widgets
    • (and others...)
  • Centralized Config: A self.tabs dictionary now defines the structure of both the Tabs and the Menus, ensuring they stay in sync.

Logic & Stability

  • Input Safety: Added try-except blocks in turn_into_array and all inline operation methods.
    • Fix: Prevents the app from crashing if the user enters non-numeric text.
  • Theme Logic: Refactored themes() into set_theme() and toggle_theme().
    • Improvement: Relies more on customtkinter's native theming rather than manually configuring widget colors line-by-line.
  • Random Generator Fix: Updated generate_op_num to correctly format list data as a space-separated string before inserting it into the text box (' '.join(map(str, ...))).

Imports

  • Added json and os to support the new StateManager.

๐Ÿ› Bug Fixes

  • Result Window Centering: Improved the math used to center the result popup window on the screen.
  • Copy Error Handling: Added safety checks when copying results to the clipboard to prevent errors if the result format is unexpected.