New
New
pyplot as plt
import pygame
import math
def start_music(file_path):
"""Play background music."""
try:
pygame.mixer.init()
pygame.mixer.music.load(file_path)
pygame.mixer.music.play(-1)
except Exception as e:
print(f"Error playing music: {e}")
def main():
file_path = "cube.xlsx"
data = load_data(file_path)
x_dim, y_dim = 12, 13
spacing = 0.2
type_monolith = "II"
total_cubes = len(data)
z_dim = math.ceil(total_cubes / (x_dim * y_dim))
cubes_dict = create_cubes(x_dim, y_dim, z_dim, total_cubes, spacing,
type_monolith)
selected_cube = [0, 0, 0]
fig.canvas.mpl_connect(
'key_press_event',
lambda event: on_key(
event, selected_cube, x_dim, y_dim, z_dim, cubes_dict, ax1, ax2, data,
tree
)
)
draw_stage(ax1, 'cyan', selected_cube, spacing, x_dim, y_dim, z_dim,
cubes_dict)
update_info_table(selected_cube, ax2, x_dim, y_dim, data, tree)
start_music("brasil.mp3")
# Define what happens when the window is closed
def on_close():
pygame.mixer.music.stop() # Stop the music
window.destroy() # Destroy the Tkinter window
window.mainloop()
if __name__ == "__main__":
main()