add Main menu
parent
d0012c46b7
commit
db228e0a76
@ -0,0 +1,60 @@
|
|||||||
|
import PySimpleGUI as sg
|
||||||
|
import random
|
||||||
|
|
||||||
|
# List of image paths
|
||||||
|
image_paths = [
|
||||||
|
"images/main_image_1.png",
|
||||||
|
"images/main_image_2.png",
|
||||||
|
"images/main_image_3.png",
|
||||||
|
"images/main_image_4.png",
|
||||||
|
"images/main_image_5.png"
|
||||||
|
]
|
||||||
|
|
||||||
|
# Select a random image
|
||||||
|
selected_image = random.choice(image_paths)
|
||||||
|
|
||||||
|
# Function to create a tile
|
||||||
|
def create_tile(image_path, text):
|
||||||
|
tile_layout = [
|
||||||
|
[sg.Image(image_path, size=(150, 150))], # Image for the tile
|
||||||
|
[sg.Text(text, justification='center', size=(15, 1))] # Text below the image
|
||||||
|
]
|
||||||
|
return sg.Column(tile_layout, element_justification='center', pad=(10, 10))
|
||||||
|
|
||||||
|
# Layout for the right grid with tiles
|
||||||
|
grid_layout = [
|
||||||
|
[create_tile("images/server.png", "Manage Server"),
|
||||||
|
create_tile("images/content.png", "Add Content")],
|
||||||
|
[create_tile("images/features.png", "Add Features"),
|
||||||
|
create_tile("images/mechanics.png", "Add Game Mechanics")]
|
||||||
|
]
|
||||||
|
|
||||||
|
# Complete layout for the window
|
||||||
|
layout = [
|
||||||
|
[sg.Image(selected_image, size=(150, 400)), # Left side image
|
||||||
|
sg.VerticalSeparator(),
|
||||||
|
sg.Column(grid_layout, element_justification='center')] # Right side grid of tiles
|
||||||
|
]
|
||||||
|
|
||||||
|
# Create the window
|
||||||
|
window = sg.Window("Rathena Server Manager", layout, element_justification='left', finalize=True)
|
||||||
|
|
||||||
|
# Allow maximizing/minimizing the window
|
||||||
|
window.TKroot.state('normal')
|
||||||
|
|
||||||
|
# Event loop
|
||||||
|
while True:
|
||||||
|
event, values = window.read()
|
||||||
|
|
||||||
|
if event == sg.WIN_CLOSED:
|
||||||
|
break
|
||||||
|
elif event == "Manage Server":
|
||||||
|
print("Navigating to Manage Server Menu...")
|
||||||
|
elif event == "Add Content":
|
||||||
|
print("Navigating to Add Content Menu...")
|
||||||
|
elif event == "Add Features":
|
||||||
|
print("Navigating to Add Features Menu...")
|
||||||
|
elif event == "Add Game Mechanics":
|
||||||
|
print("Navigating to Add Game Mechanics Menu...")
|
||||||
|
|
||||||
|
window.close()
|
Loading…
Reference in New Issue