comfy_fm24_newgens/test_gui.py

77 lines
2.2 KiB
Python
Raw Permalink Normal View History

2025-09-23 14:10:16 +01:00
#!/usr/bin/env python3
"""
Test script to verify GUI can start without problematic dependencies
"""
import sys
import os
def test_imports():
"""Test if we can import the basic GUI components"""
try:
import tkinter as tk
from tkinter import ttk, filedialog, messagebox, scrolledtext
print("✓ Tkinter imports successful")
except ImportError as e:
print(f"✗ Tkinter import failed: {e}")
return False
try:
from PIL import Image, ImageTk
print("✓ PIL imports successful")
except ImportError as e:
print(f"✗ PIL import failed: {e}")
return False
try:
import json
import configparser
import threading
import queue
import time
print("✓ Standard library imports successful")
except ImportError as e:
print(f"✗ Standard library import failed: {e}")
return False
# Test GUI components without problematic imports
try:
root = tk.Tk()
root.title("FM Face Generator - Test")
root.geometry("400x300")
# Test basic widgets
ttk.Label(root, text="GUI Test Successful!").pack(pady=20)
ttk.Button(root, text="Close", command=root.quit).pack(pady=10)
print("✓ GUI components work correctly")
root.after(1000, root.quit) # Close after 1 second
root.mainloop()
return True
except Exception as e:
print(f"✗ GUI test failed: {e}")
return False
def main():
"""Main test function"""
print("Testing FM Face Generator GUI...")
print("=" * 50)
success = test_imports()
if success:
print("\n🎉 GUI test passed! You can run: python run_gui.py")
print("\nNote: Some features may be limited without full dependencies:")
print("- Background removal may not work")
print("- RTF parsing may not work")
print("- But the GUI interface should load correctly")
else:
print("\n❌ GUI test failed. Please check your Python installation.")
print("Make sure you have Python 3.8+ with Tkinter support.")
return 0 if success else 1
if __name__ == "__main__":
sys.exit(main())