diff --git a/README.md b/README.md index ae0912e..f05ab45 100644 --- a/README.md +++ b/README.md @@ -1 +1,109 @@ -# SCEHack \ No newline at end of file +# SCE Question App + +A fun interactive application that asks "Do you like SCE?" and responds accordingly. If you answer "No", it will run a GPU stress test to show you what happens when you don't appreciate SCE! πŸ˜„ + +## Features + +- Clean, modern GUI built with tkinter +- Interactive question with Yes/No buttons +- GPU stress test using OpenCL for the "wrong" answer +- Cross-platform compatibility (Windows, macOS, Linux) + +## Requirements + +- Python 3.7 or higher +- OpenCL-compatible GPU (for the stress test) +- Virtual environment support + +## Quick Start + +### Option 1: Double-Click to Run (macOS) + +**Simply double-click `SCE Question.app` in Finder!** + +The app will automatically: +- Set up the virtual environment +- Install dependencies +- Launch the GUI + +### Option 2: Command Line (All Platforms) + +**On macOS/Linux:** +```bash +./run.sh +``` + +**On Windows:** +```bash +run.bat +``` + +**Any platform:** +```bash +python run.py +``` + +### Option 3: Manual Setup + +1. **Create and activate virtual environment:** + ```bash + python3 -m venv venv + + # On macOS/Linux: + source venv/bin/activate + + # On Windows: + venv\Scripts\activate + ``` + +2. **Install dependencies:** + ```bash + pip install -r requirements.txt + ``` + +3. **Run the application:** + ```bash + python gui_app.py + ``` + +## How It Works + +1. The application opens with a simple question: "Do you like SCE?" +2. **If you click "Yes":** The app displays "Good" and closes gracefully +3. **If you click "No":** The app displays "Wrong Answer." and launches a GPU stress test that will make your computer work hard! + +## Files Structure + +- `gui_app.py` - Main GUI application +- `main.py` - GPU stress test using OpenCL +- `SCE Question.app/` - macOS application bundle (double-click to run!) +- `run.py` - Cross-platform setup and runner script +- `run.sh` - Unix shell script for easy execution +- `run.bat` - Windows batch file for easy execution +- `requirements.txt` - Python dependencies +- `venv/` - Virtual environment (created automatically) + +## Dependencies + +- `numpy` - For numerical operations in the stress test +- `pyopencl` - For GPU computing and stress testing +- `tkinter` - For the GUI (included with Python) + +## Troubleshooting + +**OpenCL Issues:** +- Make sure you have OpenCL drivers installed for your GPU +- On macOS, OpenCL is included by default +- On Linux, install `opencl-headers` and appropriate GPU drivers +- On Windows, install GPU manufacturer's drivers + +**Virtual Environment Issues:** +- Make sure Python 3.7+ is installed +- Try running `python -m pip install --upgrade pip` before installing dependencies + +**Permission Issues on macOS/Linux:** +- Make sure the run script is executable: `chmod +x run.sh` + +## Warning + +The GPU stress test in `main.py` will run indefinitely and use significant system resources. Use Ctrl+C to stop it if needed. Don't run this on battery power or systems with cooling issues! \ No newline at end of file diff --git a/SCE Question.app/Contents/Info.plist b/SCE Question.app/Contents/Info.plist new file mode 100644 index 0000000..5a6045a --- /dev/null +++ b/SCE Question.app/Contents/Info.plist @@ -0,0 +1,53 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + en + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + SCE Question + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + NSAppleEventsUsageDescription + This script needs to control other applications to run. + NSAppleMusicUsageDescription + This script needs access to your music to run. + NSCalendarsUsageDescription + This script needs access to your calendars to run. + NSCameraUsageDescription + This script needs access to your camera to run. + NSContactsUsageDescription + This script needs access to your contacts to run. + NSHomeKitUsageDescription + This script needs access to your HomeKit Home to run. + NSMicrophoneUsageDescription + This script needs access to your microphone to run. + NSPhotoLibraryUsageDescription + This script needs access to your photos to run. + NSRemindersUsageDescription + This script needs access to your reminders to run. + NSSiriUsageDescription + This script needs access to Siri to run. + NSSystemAdministrationUsageDescription + This script needs access to administer this system to run. + OSAAppletShowStartupScreen + + + diff --git a/SCE Question.app/Contents/MacOS/applet b/SCE Question.app/Contents/MacOS/applet new file mode 100755 index 0000000..7c4c093 Binary files /dev/null and b/SCE Question.app/Contents/MacOS/applet differ diff --git a/SCE Question.app/Contents/PkgInfo b/SCE Question.app/Contents/PkgInfo new file mode 100644 index 0000000..3253614 --- /dev/null +++ b/SCE Question.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/SCE Question.app/Contents/Resources/Scripts/main.scpt b/SCE Question.app/Contents/Resources/Scripts/main.scpt new file mode 100644 index 0000000..7dd4b25 Binary files /dev/null and b/SCE Question.app/Contents/Resources/Scripts/main.scpt differ diff --git a/SCE Question.app/Contents/Resources/applet.icns b/SCE Question.app/Contents/Resources/applet.icns new file mode 100644 index 0000000..0cdd170 Binary files /dev/null and b/SCE Question.app/Contents/Resources/applet.icns differ diff --git a/SCE Question.app/Contents/Resources/applet.rsrc b/SCE Question.app/Contents/Resources/applet.rsrc new file mode 100644 index 0000000..cf2473f Binary files /dev/null and b/SCE Question.app/Contents/Resources/applet.rsrc differ diff --git a/SCE Question.app/Contents/_CodeSignature/CodeResources b/SCE Question.app/Contents/_CodeSignature/CodeResources new file mode 100644 index 0000000..b24edb1 --- /dev/null +++ b/SCE Question.app/Contents/_CodeSignature/CodeResources @@ -0,0 +1,162 @@ + + + + + files + + Resources/Scripts/main.scpt + + jCUmny8CJJuGm4Lz3Fag/Ny8q+M= + + Resources/applet.icns + + sINd6lbiqHD5dL8c6u79cFvVXhw= + + Resources/applet.rsrc + + ar5xmDs9mPpaINVXiVlVqUCB8ao= + + + files2 + + Resources/Scripts/main.scpt + + hash + + jCUmny8CJJuGm4Lz3Fag/Ny8q+M= + + hash2 + + 7HdlX38WbikegIoy1CLrqZkHb8efHPMXwzmyOqlsoyc= + + + Resources/applet.icns + + hash + + sINd6lbiqHD5dL8c6u79cFvVXhw= + + hash2 + + J7weZ6vlnv9r32tS5HFcyuPXl2StdDnfepLxAixlryk= + + + Resources/applet.rsrc + + hash + + ar5xmDs9mPpaINVXiVlVqUCB8ao= + + hash2 + + NV2dNLwgykV7aWfTBywUILBA9Lidl7F51PrkQw77SbM= + + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/app_launch.log b/app_launch.log new file mode 100644 index 0000000..e7ac227 --- /dev/null +++ b/app_launch.log @@ -0,0 +1,2 @@ +Fri Sep 5 14:09:27 PDT 2025: Setup script completed successfully +Fri Sep 5 14:09:27 PDT 2025: Application finished diff --git a/create_clickable_app.scpt b/create_clickable_app.scpt new file mode 100644 index 0000000..dc38a34 --- /dev/null +++ b/create_clickable_app.scpt @@ -0,0 +1,19 @@ +-- AppleScript to create a clickable app for SCE Question +-- This script creates an AppleScript application that can be double-clicked + +tell application "Script Editor" + set appScript to "-- SCE Question App Launcher +on run + set scriptPath to (path to me as string) + set scriptFolder to do shell script \"dirname \" & quoted form of POSIX path of scriptPath + + tell application \"Terminal\" + activate + do script \"cd \" & quoted form of scriptFolder & \" && python run.py\" + end tell +end run" + + set newDoc to make new document with properties {text:appScript} + save newDoc in file ((path to desktop as string) & \"SCE Question.app\") as Β«class scptΒ» + close newDoc +end tell diff --git a/launcher.applescript b/launcher.applescript new file mode 100644 index 0000000..c616450 --- /dev/null +++ b/launcher.applescript @@ -0,0 +1,13 @@ +-- SCE Question App Launcher +on run + set scriptPath to (path to me as string) + set scriptFolder to do shell script "dirname " & quoted form of POSIX path of scriptPath + + try + -- Run the Python script directly without showing Terminal + do shell script "cd " & quoted form of scriptFolder & " && /usr/bin/python3 run.py > /dev/null 2>&1 &" + + on error errMsg + display dialog "Error launching SCE Question App: " & errMsg buttons {"OK"} default button "OK" + end try +end run \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..73a4477 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +numpy>=1.21.0 +pyopencl>=2022.1 diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..3627e3f --- /dev/null +++ b/run.bat @@ -0,0 +1,60 @@ +@echo off +REM SCE Question App Runner Script for Windows + +echo ================================================== +echo SCE Question App Setup ^& Runner +echo ================================================== + +REM Change to script directory +cd /d "%~dp0" + +REM Check if Python is available +python --version >nul 2>&1 +if %errorlevel% neq 0 ( + echo Error: Python is required but not installed + pause + exit /b 1 +) + +echo βœ“ Python detected + +REM Create virtual environment if it doesn't exist +if not exist "venv" ( + echo Creating virtual environment... + python -m venv venv + if %errorlevel% neq 0 ( + echo Error: Failed to create virtual environment + pause + exit /b 1 + ) + echo βœ“ Virtual environment created +) else ( + echo βœ“ Virtual environment found +) + +REM Activate virtual environment and install dependencies +echo Installing dependencies... +call venv\Scripts\activate.bat +if %errorlevel% neq 0 ( + echo Error: Failed to activate virtual environment + pause + exit /b 1 +) + +venv\Scripts\pip.exe install -r requirements.txt +if %errorlevel% neq 0 ( + echo Error: Failed to install dependencies + pause + exit /b 1 +) +echo βœ“ Dependencies installed successfully + +echo. +echo ================================================== +echo Setup complete! Starting application... +echo ================================================== + +REM Run the application using the virtual environment's Python +venv\Scripts\python.exe src\gui_app.py + +pause diff --git a/run.py b/run.py new file mode 100644 index 0000000..97425d0 --- /dev/null +++ b/run.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +""" +SCE Question App Runner +This script sets up and runs the SCE Question application. +""" + +import os +import sys +import subprocess +import platform + +def check_python_version(): + """Check if Python version is compatible""" + if sys.version_info < (3, 7): + print("Error: Python 3.7 or higher is required") + sys.exit(1) + print(f"βœ“ Python {sys.version.split()[0]} detected") + +def check_virtual_environment(): + """Check if virtual environment exists and activate it""" + venv_path = os.path.join(os.path.dirname(__file__), 'venv') + + if os.path.exists(venv_path): + print("βœ“ Virtual environment found") + return True + else: + print("Creating virtual environment...") + try: + subprocess.run([sys.executable, '-m', 'venv', 'venv'], check=True) + print("βœ“ Virtual environment created") + return True + except subprocess.CalledProcessError: + print("Error: Failed to create virtual environment") + return False + +def install_dependencies(): + """Install required dependencies""" + print("Installing dependencies...") + + # Get the appropriate pip executable + if platform.system() == "Windows": + pip_executable = os.path.join('venv', 'Scripts', 'pip') + else: + pip_executable = os.path.join('venv', 'bin', 'pip') + + try: + subprocess.run([pip_executable, 'install', '-r', 'requirements.txt'], check=True) + print("βœ“ Dependencies installed successfully") + return True + except subprocess.CalledProcessError: + print("Error: Failed to install dependencies") + return False + +def run_application(): + """Run the GUI application""" + print("Starting SCE Question App...") + + # Get the appropriate python executable + if platform.system() == "Windows": + python_executable = os.path.join('venv', 'Scripts', 'python') + else: + python_executable = os.path.join('venv', 'bin', 'python') + + try: + subprocess.run([python_executable, os.path.join('src', 'gui_app.py')], check=True) + except subprocess.CalledProcessError: + print("Error: Failed to run the application") + return False + except KeyboardInterrupt: + print("\nApplication stopped by user") + return True + + return True + +def main(): + """Main setup and run function""" + print("=" * 50) + print("SCE Question App Setup & Runner") + print("=" * 50) + + # Change to script directory + script_dir = os.path.dirname(os.path.abspath(__file__)) + os.chdir(script_dir) + + # Check Python version + check_python_version() + + # Setup virtual environment + if not check_virtual_environment(): + sys.exit(1) + + # Install dependencies + if not install_dependencies(): + sys.exit(1) + + print("\n" + "=" * 50) + print("Setup complete! Starting application...") + print("=" * 50) + + # Run the application + run_application() + +if __name__ == "__main__": + main() diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..221ecba --- /dev/null +++ b/run.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# SCE Question App Runner Script +# This script sets up and runs the SCE Question application on Unix-like systems + +echo "==================================================" +echo "SCE Question App Setup & Runner" +echo "==================================================" + +# Change to script directory +cd "$(dirname "$0")" + +# Check if Python 3 is available +if ! command -v python3 &> /dev/null; then + echo "Error: Python 3 is required but not installed" + exit 1 +fi + +echo "βœ“ Python 3 detected" + +# Create virtual environment if it doesn't exist +if [ ! -d "venv" ]; then + echo "Creating virtual environment..." + python3 -m venv venv + if [ $? -ne 0 ]; then + echo "Error: Failed to create virtual environment" + exit 1 + fi + echo "βœ“ Virtual environment created" +else + echo "βœ“ Virtual environment found" +fi + +# Activate virtual environment and install dependencies +echo "Installing dependencies..." +source venv/bin/activate +pip install -r requirements.txt +if [ $? -ne 0 ]; then + echo "Error: Failed to install dependencies" + exit 1 +fi +echo "βœ“ Dependencies installed successfully" + +echo "" +echo "==================================================" +echo "Setup complete! Starting application..." +echo "==================================================" + +# Run the application +python src/gui_app.py diff --git a/run_windows_alt.bat b/run_windows_alt.bat new file mode 100644 index 0000000..4a5d763 --- /dev/null +++ b/run_windows_alt.bat @@ -0,0 +1,95 @@ +@echo off +REM SCE Question App Runner Script for Windows (Alternative Version) +REM This version handles more Python installation scenarios + +echo ================================================== +echo SCE Question App Setup ^& Runner (Windows) +echo ================================================== + +REM Change to script directory +cd /d "%~dp0" + +REM Try different Python commands to find a working one +set PYTHON_CMD= +python --version >nul 2>&1 +if %errorlevel% equ 0 ( + set PYTHON_CMD=python + goto :python_found +) + +python3 --version >nul 2>&1 +if %errorlevel% equ 0 ( + set PYTHON_CMD=python3 + goto :python_found +) + +py --version >nul 2>&1 +if %errorlevel% equ 0 ( + set PYTHON_CMD=py + goto :python_found +) + +echo Error: Python is required but not found +echo Please install Python from https://python.org +echo Make sure to check "Add Python to PATH" during installation +pause +exit /b 1 + +:python_found +echo βœ“ Python detected (%PYTHON_CMD%) + +REM Create virtual environment if it doesn't exist +if not exist "venv" ( + echo Creating virtual environment... + %PYTHON_CMD% -m venv venv + if %errorlevel% neq 0 ( + echo Error: Failed to create virtual environment + echo Make sure you have the full Python installation (not just from Microsoft Store) + pause + exit /b 1 + ) + echo βœ“ Virtual environment created +) else ( + echo βœ“ Virtual environment found +) + +REM Check if venv was created properly +if not exist "venv\Scripts\python.exe" ( + echo Error: Virtual environment is incomplete + echo Removing and recreating... + rmdir /s /q venv + %PYTHON_CMD% -m venv venv + if %errorlevel% neq 0 ( + echo Error: Still failed to create virtual environment + pause + exit /b 1 + ) +) + +REM Install dependencies using the virtual environment's pip +echo Installing dependencies... +venv\Scripts\python.exe -m pip install --upgrade pip +venv\Scripts\python.exe -m pip install -r requirements.txt +if %errorlevel% neq 0 ( + echo Error: Failed to install dependencies + echo This might be due to missing build tools or incompatible packages + pause + exit /b 1 +) +echo βœ“ Dependencies installed successfully + +echo. +echo ================================================== +echo Setup complete! Starting application... +echo ================================================== + +REM Run the application using the virtual environment's Python +venv\Scripts\python.exe src\gui_app.py +if %errorlevel% neq 0 ( + echo Error: Application failed to start + echo Check the error messages above for details +) + +echo. +echo Application finished. Press any key to close this window. +pause diff --git a/setup_for_clicking.py b/setup_for_clicking.py new file mode 100755 index 0000000..d6f6a4d --- /dev/null +++ b/setup_for_clicking.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +""" +One-time setup script for SCE Question App +Run this once to set up everything needed for double-clicking the app. +""" + +import os +import sys +import subprocess +import platform + +def main(): + print("=" * 60) + print("SCE Question App - One-Time Setup") + print("=" * 60) + print("This will set up everything needed to double-click the app!") + print() + + # Change to script directory + script_dir = os.path.dirname(os.path.abspath(__file__)) + os.chdir(script_dir) + + # Check Python version + if sys.version_info < (3, 7): + print("❌ Error: Python 3.7 or higher is required") + print(f" You have: Python {sys.version.split()[0]}") + sys.exit(1) + + print(f"βœ… Python {sys.version.split()[0]} detected") + + # Create virtual environment + venv_path = 'venv' + if os.path.exists(venv_path): + print("βœ… Virtual environment already exists") + else: + print("πŸ”§ Creating virtual environment...") + try: + subprocess.run([sys.executable, '-m', 'venv', 'venv'], check=True) + print("βœ… Virtual environment created") + except subprocess.CalledProcessError: + print("❌ Failed to create virtual environment") + sys.exit(1) + + # Install dependencies + print("πŸ”§ Installing dependencies...") + + # Get the appropriate pip executable + if platform.system() == "Windows": + pip_executable = os.path.join('venv', 'Scripts', 'pip') + else: + pip_executable = os.path.join('venv', 'bin', 'pip') + + try: + subprocess.run([pip_executable, 'install', '-r', 'requirements.txt'], + check=True, capture_output=True, text=True) + print("βœ… Dependencies installed successfully") + except subprocess.CalledProcessError as e: + print("❌ Failed to install dependencies") + print(f" Error: {e.stderr}") + sys.exit(1) + + # Test that everything works + print("πŸ§ͺ Testing installation...") + + # Get the appropriate python executable + if platform.system() == "Windows": + python_executable = os.path.join('venv', 'Scripts', 'python') + else: + python_executable = os.path.join('venv', 'bin', 'python') + + try: + result = subprocess.run([python_executable, '-c', 'import numpy, pyopencl; print("All imports successful!")'], + capture_output=True, text=True, check=True) + print("βœ… All dependencies working correctly") + except subprocess.CalledProcessError as e: + print("⚠️ Dependencies installed but there might be issues:") + print(f" {e.stderr}") + print(" The app might still work - try double-clicking it!") + + print() + print("=" * 60) + print("πŸŽ‰ Setup Complete!") + print("=" * 60) + + if platform.system() == "Darwin": # macOS + print("You can now double-click 'SCE Question.app' to run the app!") + elif platform.system() == "Windows": + print("You can now double-click 'run.bat' to run the app!") + else: + print("You can now run './run.sh' to start the app!") + + print() + print("If you encounter any issues, check the 'app_launch.log' file for details.") + +if __name__ == "__main__": + main() diff --git a/gui_app.py b/src/gui_app.py similarity index 92% rename from gui_app.py rename to src/gui_app.py index 54e6ec4..69b8e30 100644 --- a/gui_app.py +++ b/src/gui_app.py @@ -2,6 +2,7 @@ from tkinter import messagebox import subprocess import sys +import os class SCEQuestionApp: def __init__(self, root): @@ -94,7 +95,10 @@ def quit_and_run_main(self): """Quit the GUI and run main.py""" self.root.quit() try: - subprocess.Popen([sys.executable, "main.py"]) + # Get the directory where this script is located + script_dir = os.path.dirname(os.path.abspath(__file__)) + main_py_path = os.path.join(script_dir, "main.py") + subprocess.Popen([sys.executable, main_py_path]) except Exception as e: print(f"Error running main.py: {e}") diff --git a/main.py b/src/main.py similarity index 100% rename from main.py rename to src/main.py