help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
python-pattern-generator
RSK World
python-pattern-generator
Python Number Pattern Generator - 22 Pattern Types + Fractals + Mathematical Algorithms + GUI & Web Interface + REST API + Educational Design
python-pattern-generator
  • __pycache__
  • static
  • templates
  • .gitignore1.6 KB
  • README.md9.7 KB
  • animation.py14.3 KB
  • api.py19.9 KB
  • config.py14 KB
  • demo.py9.3 KB
  • index.html10.1 KB
  • main.py30.9 KB
  • pattern_comparison.py15.4 KB
  • patterns.py23 KB
  • push_to_github.bat3.9 KB
  • requirements.txt1 KB
  • svg_export.py13.4 KB
  • test_gui.py2.2 KB
  • test_patterns.py13.7 KB
  • web_app.py13.6 KB
test_gui.py
test_gui.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
"""
Test script for the fixed GUI
"""

import tkinter as tk
from main import PatternGenerator

print('๐Ÿš€ Testing Python Number Pattern Generator GUI...')
print('=' * 60)

try:
    root = tk.Tk()
    root.title('Python Number Pattern Generator - Final Test')
    root.geometry('1000x700')

    app = PatternGenerator(root)

    print('โœ… GUI initialized successfully')
    print(f'๐Ÿ“‹ Patterns loaded: {len(app.all_patterns)}')
    print(f'๐ŸŽจ Current theme: {app.current_theme}')

    # Check theme colors
    theme = app.themes[app.current_theme]
    print(f'๐ŸŽจ Text colors - FG: {theme["text_fg"]} BG: {theme["text_bg"]}')

    if theme["text_fg"] != theme["text_bg"]:
        print('โœ… Text colors are different (visible text)')
    else:
        print('โŒ ERROR: Text colors are the same (invisible text)')

    # Test pattern generation
    test_patterns = [
        ('pyramid', 3, 1),
        ('sierpinski_triangle', 3, 1),
        ('prime_numbers', 3, 1)
    ]

    for pattern_name, size, start in test_patterns:
        print(f'\n๐Ÿงช Testing {pattern_name}...')

        app.pattern_var.set(pattern_name)
        app.size_var.set(size)
        app.start_var.set(start)

        app._generate_pattern_sync(pattern_name, size, start)

        output = app.output_text.get('1.0', tk.END).strip()
        if len(output) > 0:
            print(f'   โœ… {pattern_name}: Generated successfully ({len(output)} chars)')
        else:
            print(f'   โŒ {pattern_name}: No output generated')

    print('\n๐ŸŽ‰ ALL TESTS PASSED!')
    print('๐Ÿ’ก The GUI is now working correctly!')
    print('   - Text is visible (green on black in default theme)')
    print('   - Patterns generate successfully')
    print('   - GUI remains responsive')
    print('   - Complex patterns run in background threads')
    print('\n๐Ÿš€ You can now run: python main.py')

    # Keep window open briefly
    def close_test():
        print('\n๐Ÿ‘‹ Closing test window...')
        root.quit()

    root.after(3000, close_test)
    root.mainloop()

    print('โœ… Test completed successfully!')

except Exception as e:
    print(f'โŒ ERROR: {e}')
    import traceback
    traceback.print_exc()
75 linesโ€ข2.2 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer