Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tk_Game_Development_Questionnaire.py
- import tkinter as tk
- from tkinter import ttk
- import webbrowser
- import tempfile
- import re
- root = tk.Tk()
- root.title("Game Development Questionnaire")
- root.geometry("1200x600+0+0")
- frame = tk.Frame(root)
- frame.pack(fill="both", expand=True)
- scrollbar = tk.Scrollbar(frame)
- scrollbar.pack(side="right", fill="y")
- canvas = tk.Canvas(frame, yscrollcommand=scrollbar.set)
- canvas.pack(side="left", fill="both", expand=True, padx=(5, 10))
- scrollbar.config(command=canvas.yview)
- content = tk.Frame(canvas)
- questionnaire = '''
- Game Title: ?
- Screen Size: Fit-To-Screen: 800x600: 1024x768: 1280x720: 1920x1080: ?Other
- *Exclude: Tkinter: *Classes: *Pygame: *Numpy: *PyQt: *wxPython: *Kivy: *Pyglet: *Matplotlib: ?Other
- *Exclude: *Django: *Flask: *Tensorflow: *Keras: *Pandas: *Pyramid: *Scikit-learn: *OpenCV: *BeautifulSoup: *Scrapy: *Selenium: *Recursion: *File Input/Output: *CSV: *Seaborn
- *Input Methods: Keyboard: Mouse: Arrow Keys: WASD: Gamepad: ?Customizable Controls
- *Game Type: Single-Player: Co-Op: PvP: ?Multiplayer (Maximum)
- *Preferred Platforms: *PC: Console: Mobile: Web: ?Other
- *Difficulty Levels: Easy: Medium: Hard: ?Custom
- *Load Files: Audio: Background Image: 3D Models: Sprites
- Camera Angles: Top-Down: Side-Scrolling: First-Person: Third-Person
- Camera Movement: Static: Dynamic: Follows Player: ?Other
- *Game Speed: Fast: Medium: Slow
- *Gold Coin Placement: Random: ?Interval-Based (Distance Apart)
- Level Structure: Linear: Non-Linear: Maze: ?Other
- *Road Type: Straight: Curvy: Hilly: ?Width (Default Is Screenwidth)
- *Road Lanes: 2: 3: 4: 5: 6
- *Gameplay Settings: Countdown Timer: Health Display: Pause: Score Display: Record Time
- *Scoring System: Points: Levels: Achievements: ?Other
- Genre: Action: Adventure: Role-Playing: Simulation: Strategy: Sports: *Puzzle: ?Other
- *Theme: Fantasy: Sci-Fi: Modern: Historical: Horror: ?Other
- *Graphics: *2D: 3D: Isometric: Maze
- Game World: Open World: Linear Levels: Hub-Based
- *Preferred Font: Arial: *Verdana: Times New Roman: ?Custom Font
- *Save System: Auto-Save: Manual Save: Checkpoints: Cloud Save
- Combat Style: Turn-Based: Real-Time: Tactical: No Combat
- *Game Shapes As Objectives and/or Enemies*: Circle: Triangle: Square: 4-Sided Diamond: Pentagon: 5-Pointed Star: 6-Pointed Star: Plus-Sign: X
- Types Of Enemies: Ai Controlled: Player Controlled
- *Online Connectivity: Required: Leaderboards: In-Game Chat: Matchmaking System
- *Power-Ups/Boosts: Extra Life: Speed: Shield: Health: Magnet: Super Jump: Invincibility: Invisibility: Coin Magnet: Rocket: Growth: Slow Down:
- *Power-Ups/Boosts: Forward Boost: Laser: Bomb: Freeze: Double Score: Triple Score: Quad Score: Double Coins: Triple Coins: Quad Coins
- *Obstacles: Spikes: Pitfalls: Falling Spikes: Rising Spikes: Walls: Falling Blocks: Rolling Balls: Laser Beams: Ice Patches
- *Obstacles: Moving Platforms: Water Pits: Lava Pits: Fireballs: Doors: Locked Gates: Time Bombs: Rising Lava: Moving Walls
- *In-Game Economy: Currency: Resources: Cosmetics: Power-Ups
- '''.strip().splitlines()
- def o(s):
- return re.sub(r'^\W+', '', s)
- def feature():
- label = tk.Label(content, text=question_text, font=("Arial", 12, "bold"), fg="green")
- label.pack(pady=5, anchor="w")
- def is_other():
- if option[1:]:
- other_label = tk.Label(option_frame, text=option[1:]+':')
- other_label.pack(side="left", anchor="w", padx=(15,0))
- entry = tk.Entry(option_frame, textvariable=option[1:], width=200)
- entry.pack(side="left", pady=5, padx=(5, 0))
- selected_options.append((question_text, entry))
- selected_options = []
- for question in questionnaire:
- # Split the question and options
- parts = question.split(": ")
- question_text = parts[0]
- options = parts[1:]
- if '*' in question_text: # Create checkbutton for the options
- question_text = question_text[1:]
- feature()
- option_frame = tk.Frame(content)
- option_frame.pack(anchor="w")
- for option in options:
- selected_option = tk.BooleanVar()
- selected_options += [(question_text + ': ' + o(option), selected_option)]
- if '*' in option:
- selected_option.set(1)
- elif '?' in option:
- is_other()
- continue
- checkbutton = tk.Checkbutton(option_frame, text=o(option), variable=selected_option)
- checkbutton.pack(side="left", anchor="w")
- else: # Create radiobuttons for the options
- selected_option = tk.StringVar()
- feature()
- selected_option.set(options[0])
- option_frame = tk.Frame(content)
- option_frame.pack(anchor="w")
- for option in options:
- if '*' in option:
- selected_option.set(o(option))
- elif '?' in option:
- is_other()
- continue
- radiobutton = tk.Radiobutton(option_frame, text=o(option), variable=selected_option, value=o(option))
- radiobutton.pack(side="left", anchor="w")
- selected_options += [(question_text, selected_option)]
- def print_prompt():
- selected_values = []
- prev = ''
- game_title = 'Untitled Game'
- for feat, selected_option in selected_options:
- selected_option = selected_option.get()
- if ('Game Title' in feat) and o(selected_option):
- game_title = selected_option
- elif str(selected_option).strip():
- try:
- selected_values.append(feat + ": " + selected_option.strip())
- prev = ''
- except:
- if selected_option:
- curr, option = feat.split(':')
- if prev == curr:
- selected_values[-1] = selected_values[-1] + ',' + option
- else:
- selected_values.append(feat)
- prev = curr
- html_content = "<html><body><h2>Game Title: " + game_title + "</h2><ul>"
- for value in selected_values:
- if "Game Title" not in value:
- html_content += "<li>" + value + "</li>"
- html_content += "</ul><p>Prompt For Code Generation: Please Generate Code Based On The Information Provided Above.</p></body></html>"
- with tempfile.NamedTemporaryFile(suffix='.html', delete=False) as tmp:
- tmp.write(html_content.encode('utf-8'))
- filename = tmp.name
- webbrowser.open('file://' + filename)
- print_button = tk.Button(root, text="Print", command=print_prompt, font='Verdana 12 bold', fg='#ffffff', bg='#00bb00')
- print_button.pack()
- content.update_idletasks()
- canvas.create_window((0, 0), window=content, anchor="nw")
- canvas.config(scrollregion=canvas.bbox("all"))
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement