Tolong perbaiki kode isi file CRUD_Gn_Cyan_Bawah(gabung).py berikut ini pada bagian fungsi def pilih_nada(), agar supaya data gugus nada Bass dari kolom Bass dari Gn_Cyan_Bawah pada kondisi semua progres (progres 1, 2, dan 3) dapat ditampilkan pada entry_bass, dan juga data gugus nada Bass dari kolom Bass dari Sub_Gn_Cyan_Bawah dapat ditampilkan pada entry_sub_bass pada kondisi semua progres (progres 1, 2, dan 3).
Berikut kode isi filenya:
import tkinter as tk
from tkinter import ttk
import sqlite3
from tkinter import messagebox
from tkinter import filedialog
from tkinter import Tk, Label, Entry, Button, Frame, StringVar
import subprocess
import os
import logging
# Initialize logging
logging.basicConfig(level=logging.INFO)
# Initialize the main window
root = tk.Tk()
root.geometry("690x1390")
root.title("Arah Arus Musik")
# Head Frame
head_frame = tk.Frame(root, bg="#158aff", highlightbackground="white", highlightthickness=1)
head_frame.place()
# Content Frame
content_frame = tk.Frame(root)
content_frame.pack()
# Koneksi ke database dan inisialisasi tabel jika belum ada
def init_db():
conn = sqlite3.connect('DATAMUSIK.db')
c = conn.cursor()
c.execute('''
CREATE TABLE IF NOT EXISTS Gn_Cyan_Bawah (
ID INTEGER PRIMARY KEY,
Level_R TEXT,
Bass INT,
Trebel_Biasa INT,
Trebel_Aneh INT
)
''')
c.execute('''
CREATE TABLE IF NOT EXISTS Sub_Gn_Cyan_Bawah(
Sub_ID INTEGER PRIMARY KEY,
Level_D TEXT,
Bass INT,
Trebel_Biasa INT,
Trebel_Aneh INT
)
''')
conn.commit()
conn.close()
# Function to clear content frame
def clear_content_frame():
for widget in content_frame.winfo_children():
widget.destroy()
# Function to switch modes and update pages
def switch_mode(progres, mode):
if mode[progres - 1] == "naik":
mode[progres - 1] = "turun"
setup_turun_mode(progres)
else:
mode[progres - 1] = "naik"
setup_naik_mode(progres)
# Options Frame
options_frame = tk.Frame(root, bg="#c3c3c3")
# Current mode for each toggle button
current_mode = ['naik', 'naik', 'naik']
toggle_btns = []
indicator_labels = []
pages = [
['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass'],
['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass'],
['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass']
]
# Function to toggle menus
def toggle_menu(progres, mode):
if mode[progres - 1] == 'naik':
mode[progres - 1] = 'turun'
toggle_btns[progres - 1].config(text="X _ T")
pages[progres - 1] = ['Gn_A_Bass', 'Gn_Biru', 'Gn_Cyan_Bawah', 'Gn_A_Trebel']
indicator_labels[progres - 1].config(text="Turun")
else:
mode[progres - 1] = 'naik'
toggle_btns[progres - 1].config(text="☰ _ N")
pages[progres - 1] = ['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass']
indicator_labels[progres - 1].config(text="Naik")
update_options_frame(progres)
display_pages(progres)
# Function to display pages
def display_pages(progres):
for widget in content_frame.winfo_children():
widget.destroy()
display_gn_cyan_bawah_page()
# Function to display default page
def display_gn_cyan_bawah_page():
clear_content_frame()
tk.Label(content_frame, text="Ini adalah Halaman Gn_Cyan_Bawah", font=("Helvetica", 10)).pack()
# Function to setup "Naik" mode
def setup_naik_mode(progres):
if progres == 1:
pages[0] = ['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass']
elif progres == 2:
pages[1] = ['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass']
elif progres == 3:
pages[2] = ['Gn_A_Trebel', 'Gn_Biru', 'Gn_Cyan_Atas', 'Gn_A_Bass']
# Function to setup "Turun" mode
def setup_turun_mode(progres):
if progres == 1:
pages[0] = ['Gn_A_Bass', 'Gn_Biru', 'Gn_Cyan_Bawah', 'Gn_A_Trebel']
elif progres == 2:
pages[1] = ['Gn_A_Bass', 'Gn_Biru', 'Gn_Cyan_Bawah', 'Gn_A_Trebel']
elif progres == 3:
pages[2] = ['Gn_A_Bass', 'Gn_Biru', 'Gn_Cyan_Bawah', 'Gn_A_Trebel']
# Toggle Button 1
toggle_btn1 = tk.Button(head_frame, text="☰ _ P 1", bg="#158aff", font=("bold", 6), fg="white", bd=0, activebackground="#158aff", activeforeground="white", command=lambda: toggle_menu(1, current_mode))
toggle_btn1.pack(side=tk.LEFT)
toggle_btn1.place(x=5, y=20)
toggle_btns.append(toggle_btn1)
title_lb1 = tk.Label(head_frame, text="Progres-1", bg="#158aff", fg="white", font=("bold", 7))
title_lb1.pack(side=tk.LEFT)
title_lb1.place(x=108, y=11)
indicator_label1 = tk.Label(head_frame, text="Naik", bg="#158aff", fg="yellow", font=("bold", 8))
indicator_label1.pack(side=tk.LEFT)
indicator_label1.place(x=127, y=55)
indicator_labels.append(indicator_label1)
# Toggle Button 2
toggle_btn2 = tk.Button(head_frame, text="☰ _ P 2", bg="#158aff", font=("bold", 6), fg="white", bd=0, activebackground="#158aff", activeforeground="white", command=lambda: toggle_menu(2, current_mode))
toggle_btn2.pack(side=tk.LEFT)
toggle_btn2.place(x=232, y=20)
toggle_btns.append(toggle_btn2)
title_lb2 = tk.Label(head_frame, text="Progres-2", bg="#158aff", fg="white", font=("bold", 7))
title_lb2.pack(side=tk.LEFT)
title_lb2.place(x=334, y=5)
indicator_label2 = tk.Label(head_frame, text="Naik", bg="#158aff", fg="yellow", font=("bold", 8))
indicator_label2.pack(side=tk.LEFT)
indicator_label2.place(x=368, y=55)
indicator_labels.append(indicator_label2)
# Toggle Button 3
toggle_btn3 = tk.Button(head_frame, text="☰ _ P 3", bg="#158aff", font=("bold", 6), fg="white", bd=0, activebackground="#158aff", activeforeground="white", command=lambda: toggle_menu(3, current_mode))
toggle_btn3.pack(side=tk.LEFT)
toggle_btn3.place(x=460, y=20)
toggle_btns.append(toggle_btn3)
title_lb3 = tk.Label(head_frame, text="Progres-3", bg="#158aff", fg="white", font=("bold", 7))
title_lb3.pack(side=tk.LEFT)
title_lb3.place(x=565, y=5)
indicator_label3 = tk.Label(head_frame, text="Naik", bg="#158aff", fg="yellow", font=("bold", 8))
indicator_label3.pack(side=tk.LEFT)
indicator_label3.place(x=599, y=55)
indicator_labels.append(indicator_label3)
head_frame.pack(side=tk.TOP, fill=tk.X)
head_frame.pack_propagate(False)
head_frame.configure(height=120)
options_frame.pack(side=tk.LEFT)
options_frame.pack_propagate(False)
options_frame.configure(width=170, height=300)
# Bottom Frame
bottom_frame = tk.Frame(root, bg="#e2e2e2")
bottom_frame.pack(side=tk.TOP, fill=tk.X)
# Function to clear content frame
def clear_content_frame():
for widget in content_frame.winfo_children():
widget.destroy()
def open_data_gn_cyan_bawah_file():
filepath = "DATA_Gn_Cyan_Bawah(gabung).py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
#Gugusan Nada Terpilih: "Gn_Cyan_Atas" Terpilih
gugusan_label = tk.Label(bottom_frame, text="Gn_Cyan_Bawah", fg="tomato")
gugusan_label.grid(row=0, column=0, padx=10, pady=5, sticky="ew")
# Data Buttons
crud_btn = tk.Button(bottom_frame, text="DATA", command=open_data_gn_cyan_bawah_file, bg="green", fg="white")
crud_btn.grid(row=5, column=0, padx=10, pady=5)
label_info = tk.Label(bottom_frame, fg="tomato", text="Pilih gugusan nada Gn_Cyan_Bawah \n untuk dirangkai dalam \n notasi angka lagu:\n")
label_info.grid(row=6, column=1, sticky="w", padx=0, pady=5)
# Logika_Gn_Cyan_Bawah.py
def Level_Gn():
level_gn_urut = []
# Kondisi untuk Gn_Cyan_Bawah
if Gn_Cyan_Bawah:
for i in range(1, 13):
if i % 4 == 1:
level_gn_urut.append((i, 'Bass ID 1'))
elif i % 4 == 2:
level_gn_urut.append((i, 'Bass ID 2'))
elif i % 4 == 3:
level_gn_urut.append((i, 'Bass ID 3'))
else:
level_gn_urut.append((i, 'Bass ID 4'))
# Kondisi untuk Sub_Gn_Cyan_Bawah
elif Sub_Gn_Cyan_Bawah:
for i in range(1, 13):
level_gn_urut.append((i, 'Bass Sub_ID 1'))
return level_gn_urut
# Fungsi untuk validasi ID dan Level_Gn
def validate_id_and_level_gn():
try:
id_selected = int(entry_id.get())
level_gn = int(entry_level_gn.get())
# Validasi berdasarkan urutan level_gn dan ID
if (level_gn % 4 == 1 and id_selected != 1) or \
(level_gn % 4 == 2 and id_selected != 2) or \
(level_gn % 4 == 3 and id_selected != 3) or \
(level_gn % 4 == 0 and id_selected != 4):
raise ValueError
except ValueError:
messagebox.showerror("Error", "Level_Gn ada 1-12. L-1 = L-5 = L-9 = ID 1, L-2 = L-6 = L-10 = ID 2, L-3 = L-7 = L-11 = ID 3, L-4 = L-8 = L-12 = ID 4.")
return False
return True
# Fungsi untuk mengambil data Gn_Cyan_Bawah dari database berdasarkan ID
def get_data_gn_cyan_bawah_from_db(id_selected):
conn = sqlite3.connect("DATAMUSIK.db")
cursor = conn.cursor()
cursor.execute("SELECT * FROM Gn_Cyan_Bawah WHERE ID = ?", (id_selected,))
data = cursor.fetchone()
conn.close()
return data
# Fungsi untuk mengambil data Sub_Gn_Cyan_Bawah dari database berdasarkan ID
def get_data_sub_gn_cyan_bawah_from_db(id_selected):
conn = sqlite3.connect("DATAMUSIK.db")
cursor = conn.cursor()
cursor.execute("SELECT * FROM Sub_Gn_Cyan_Bawah WHERE Sub_ID = ?", (id_selected,))
data = cursor.fetchone()
conn.close()
return data
# Fungsi untuk menyesuaikan nilai Trebel berdasarkan progres
def adjust_trebel_value(bass_value, adjustment):
# Implementasi logika untuk menyesuaikan nilai Trebel
try:
adjusted_value = str(int(bass_value) + adjustment)
except ValueError:
adjusted_value = bass_value # Jika nilai bass bukan angka, biarkan tetap sama
return adjusted_value
# Fungsi untuk memilih nada Bass berdasarkan Gugus_nads, Level_Gn ID, progres, dan mode
def pilih_nada():
try:
# Ambil nilai dari entry_id dan variabel progres serta mode
level_gn = int(entry_level_gn.get())
id_selected = int(entry_id.get())
mode = mode_var.get().lower()
progres = int(progres_var.get()) if progres_var.get() else 0
# Dapatkan data dari database
data_gn_cyan_bawah = get_data_gn_cyan_bawah_from_db(id_selected)
data_sub_gn_cyan_bawah = get_data_sub_gn_cyan_bawah_from_db(id_selected)
if not data_gn_cyan_bawah or not data_sub_gn_cyan_bawah:
messagebox.showerror("Error", "Data tidak ditemukan dalam database.")
return
# Hapus data sebelumnya di EntryBox
entry_bass.delete(0, tk.END)
entry_sub_bass.delete(0, tk.END)
# Ambil nilai Bass dan Sub_Bass
bass_value = data_gn_cyan_bawah[2]
sub_bass_value = data_sub_gn_cyan_bawah[2]
# Logika pengisian data Bass dan Sub_Bass ke EntryBox berdasarkan ID, Progres, Mode, dan Level_Gn
bass_id = int(data_gn_cyan_bawah[0])
sub_bass_id = int(data_sub_gn_cyan_bawah[0])
level_gn = None
# Logika untuk tabel Gn_Cyan_Bawah
if bass_id == 1:
if mode == 'naik' or mode == 'turun':
if progres in [1, 2, 3]:
level_gn = [1, 5, 9]
elif bass_id == 2:
if mode == 'naik' or mode == 'turun':
if progres in [1, 2, 3]:
level_gn = [2, 6, 10]
elif bass_id == 3:
if mode == 'naik' or mode == 'turun':
if progres in [1, 2, 3]:
level_gn = [3, 7, 11]
elif bass_id == 4:
if mode == 'naik' or mode == 'turun':
if progres in [1, 2, 3]:
level_gn = [4, 8, 12]
# Logika untuk tabel Sub_Gn_Cyan_Bawah
if sub_bass_id == 1:
if mode == 'naik' or mode == 'turun':
if progres in [1, 2, 3]:
level_gn = list(range(1, 13))
# Jika level_gn ditemukan, isi EntryBox dengan data yang sesuai
if level_gn:
entry_bass.insert(0, bass_value)
entry_sub_bass.insert(0, sub_bass_value)
else:
messagebox.showerror("Error", "ID tidak valid")
return
messagebox.showinfo("Success", "Data berhasil diambil dan disesuaikan")
except ValueError:
messagebox.showerror("Error", "ID dan progres harus berupa angka")
# Frame untuk ID dan progres
frame_top = tk.Frame(root)
frame_top.pack(pady=10)
# CRUD Functions
def clear_entries():
for row in entry_rows:
for entry in row:
entry.delete(0, tk.END)
label_nada = tk.Label(frame_top, text="Nada:")
label_nada.grid(row=0, column=0, padx=5, pady=5)
nada_var = tk.StringVar()
nada_combobox = ttk.Combobox(frame_top, textvariable=nada_var)
nada_combobox['values'] = ("Bass", "Trebel")
nada_combobox.grid(row=0, column=1, padx=5, pady=5)
label_Level_Gn = tk.Label(frame_top, text="Level_Gn:")
label_Level_Gn.grid(row=1, column=0, padx=5, pady=5)
entry_level_gn = tk.Entry(frame_top)
entry_level_gn.grid(row=1, column=1, padx=5, pady=5)
label_id = tk.Label(frame_top, text="ID:")
label_id.grid(row=2, column=0, padx=5, pady=5)
entry_id = tk.Entry(frame_top)
entry_id.grid(row=2, column=1, padx=5, pady=5)
label_progres = tk.Label(frame_top, text="Progres:")
label_progres.grid(row=3, column=0, padx=5, pady=5)
progres_var = tk.StringVar()
progres_combobox = ttk.Combobox(frame_top, textvariable=progres_var)
progres_combobox['values'] = (1, 2, 3)
progres_combobox.grid(row=3, column=1, padx=5, pady=5)
label_mode = tk.Label(frame_top, text="Mode:")
label_mode.grid(row=4, column=0, padx=5, pady=5)
mode_var = tk.StringVar()
mode_combobox = ttk.Combobox(frame_top, textvariable=mode_var)
mode_combobox['values'] = ("Naik", "Turun")
mode_combobox.grid(row=4, column=1, padx=5, pady=5)
separator = ttk.Separator(frame_top, orient='horizontal')
separator.grid(row=6, column=0, sticky="ew", pady=15)
# Hapus label, entry field, dan combobox untuk Progres dan Mode yang tidak digunakan lagi
# abel_progres.grid_forget()
# progres_combobox.grid_forget()
# label_mode.grid_forget()
# mode_combobox.grid_forget()
# Bottom Frame
bottom_frame = tk.Frame(root, bg="#e2e2e2")
bottom_frame.pack(side=tk.TOP, fill=tk.X)
# Label Gugusan Nada Terpilih Field
Gn_tetpilih_label = tk.Label(bottom_frame, text="Gugusan- \n Nada Terpilih:")
Gn_tetpilih_label.grid(row=8, column=0, padx=5, pady=5)
#Label dan Entry Ambil Gugusan nada Teroilih
label_bass = tk.Label(bottom_frame, text="Bass Gn Cyan Bawah:")
label_bass.grid(row=7, column=1, padx=5, pady=5)
entry_bass = tk.Entry(bottom_frame)
entry_bass.grid(row=8, column=1, padx=5, pady=5)
label_sub_bass = tk.Label(bottom_frame, text="Bass Sub Gn Cyan Bawah:")
label_sub_bass.grid(row=7, column=2, padx=5, pady=5)
entry_sub_bass = tk.Entry(bottom_frame)
entry_sub_bass.grid(row=8, column=2, padx=5, pady=5)
label_trebel = tk.Label(bottom_frame, text="Trebel Gn Cyan Bawah")
label_trebel.grid(row=7, column=3, padx=5, pady=5)
entry_trebel = tk.Entry(bottom_frame)
entry_trebel.grid(row=8, column=3, padx=5, pady=5)
label_sub_trebel = tk.Label(bottom_frame, text="Trebel Sub Gn Cyan Bawah:")
label_sub_trebel.grid(row=7, column=4, padx=5, pady=5)
entry_sub_trebel = tk.Entry(bottom_frame)
entry_sub_trebel.grid(row=8, column=4, padx=5, pady=5)
# Fungsi untuk membuka file CRUD_Gn_Cyan_Bawah(gabung).py
active_page = None # Menyimpan halaman aktif
# Fungsi untuk menjalankan file CRUD_Gn_A_Trebel.py, CRUD_Gn_Biru.py, CRUD_Gn_Cyan_Bawah.py, CRUD_Gn_Cysn_Atas.py, dan CRUD_Gn_A_Bass.py
def run_gn_a_trebel_file():
filepath = "CRUD_Gn_A_Trebel.py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
def run_gn_biru_file():
filepath = "CRUD_Gn_Biru.py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
def run_gn_cyan_bawah_file():
filepath = "CRUD_Gn_Cyan_Bawah(gabung).py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
def run_gn_cyan_atas_file():
filepath = "CRUD_Gn_Cyan_Atas(gabung).py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
def run_gn_a_bass_file():
filepath = "CRUD_Gn_A_Bass.py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
# Function to display the options based on the current mode and progress
def update_options_frame(progres):
# Clear existing buttons
for widget in options_frame.winfo_children():
widget.destroy()
if current_mode[progres - 1] == "turun":
Gn_Cyan_Bawah_btn = tk.Button(options_frame, text="Gn_Cyan_Bawah", font=("bold", 5), fg="yellow", bd=0, bg="green", command=run_gn_cyan_bawah_file)
Gn_Cyan_Bawah_btn.place(x=3, y=0)
Gn_Cyan_Bawah_indicate = tk.Label(options_frame, text="Ini Gn_Cyan_Bawah ", bg="#c3c3c3")
Gn_Cyan_Bawah_indicate.place(x=2, y=155, width=5, height=45)
Gn_A_Trebel_btn = tk.Button(options_frame, text="Gn_A_Trebel", font=("bold", 6), fg="yellow", bd=0, bg="grey", command=run_gn_a_trebel_file)
Gn_A_Trebel_btn.place(x=3, y=50)
Gn_A_Trebel_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_A_Trebel_indicate.place(x=2, y=55, width=5, height=45)
else: # Mode "naik"
Gn_Cyan_Bawah_btn = tk.Button(options_frame, text="Gn_Cyan_Bawah", font=("bold", 5), fg="yellow", bd=0, bg="green", command=run_gn_cyan_bawah_file)
Gn_Cyan_Bawah_btn.place(x=3, y=0)
Gn_Cyan_Bawah_indicate = tk.Label(options_frame, text="Ini Gn_Cyan_Bawah ", bg="#c3c3c3")
Gn_Cyan_Bawah_indicate.place(x=2, y=5, width=5, height=45)
Gn_Cyan_Atas_btn = tk.Button(options_frame, text="Gn_Cyan_Atas", font=("bold", 5), fg="yellow", bd=0, bg="green", command=run_gn_cyan_atas_file)
Gn_Cyan_Atas_btn.place(x=3, y=50)
Gn_Cyan_Atas_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_Cyan_Atas_indicate.place(x=2, y=55, width=5, height=45)
Gn_Biru_btn = tk.Button(options_frame, text="Gn_Biru", font=("bold", 7), fg="yellow", bd=0,bg="blue", command=run_gn_biru_file)
Gn_Biru_btn.place(x=3, y=100)
Gn_Biru_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_Biru_indicate.place(x=2, y=105, width=5, height=45)
Gn_A_Bass_btn = tk.Button(options_frame, text="Gn_A_Bass", font=("bold", 7), fg="yellow", bd=0, bg="grey", command=run_gn_a_bass_file)
Gn_A_Bass_btn.place(x=3, y=150)
Gn_A_Bass_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_A_Bass_indicate.place(x=2, y=155, width=5, height=45)
# Call update_options_frame for the initial setup
update_options_frame(1)
# Function to display Gn_A_Trebel page
def Gn_A_Trebel_page():
clear_content_frame()
tk.Label(content_frame, text="Ini adalah halaman Gn_A_Trebel", font=("Helvetica", 10)).pack()
# Function to display Gn_Biru page
def Gn_Biru_page():
clear_content_frame()
tk.Label(content_frame, text="Ini adalah halaman Gn_Biru", font=("Helvetica", 10)).pack()
# Function to display Gn_Cyan_Bawah page
def Gn_Cyan_Bawah_page():
clear_content_frame()
tk.Label(content_frame, text="Ini adalah halaman Gn_Cyan_Bawah", font=("Helvetica", 10)).pack()
# Function to display Gn_Cyan_Atas page
def Gn_Cyan_Atas_page():
clear_content_frame()
tk.Label(content_frame, text="Ini adalah halaman Gn_Cyan_Atas", font=("Helvetica", 10)).pack()
# Function to display Gn_Biru page
def Gn_A_Bass_page():
clear_content_frame()
tk.Label(content_frame, text="Ini adalah halaman Gn_A_Bass", font=("Helvetica", 10)).pack()
# Initialize the default page
def init_default_page():
update_options_frame(1) # Default to showing options for Progres-1
clear_content_frame()
tk.Label(content_frame, text="Halaman Default Gugus Nada", font=("Helvetica", 10)).pack()
#Fungsi tombol di options_frame
Gn_A_Trebel_btn = tk.Button(options_frame, text="Gn_A_Trebel", font=("bold", 6), fg="yellow", bd=0, bg="grey", command=run_gn_a_trebel_file)
Gn_A_Trebel_btn.place(x=3, y=0)
Gn_A_Trebel_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_A_Trebel_indicate.place(x=2, y=5, width=5, height=45)
Gn_Biru_btn = tk.Button(options_frame, text="Gn_Biru", font=("bold", 7), fg="yellow", bd=0,bg="blue", command=run_gn_biru_file)
Gn_Biru_btn.place(x=3, y=50)
Gn_Biru_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_Biru_indicate.place(x=2, y=55, width=5, height=45)
Gn_Cyan_Bawah_btn = tk.Button(options_frame, text="Gn_Cyan_Bawah", font=("bold", 5), fg="yellow", bd=0, bg="green", command=run_gn_cyan_bawah_file)
Gn_Cyan_Bawah_btn.place(x=3, y=100)
Gn_Cyan_Bawah_indicate = tk.Label(options_frame, text="Ini Gn_Cyan_Bawah ", bg="#c3c3c3")
Gn_Cyan_Bawah_indicate.place(x=2, y=105, width=5, height=45)
Gn_Cyan_Atas_btn = tk.Button(options_frame, text="Gn_Cyan_Atas", font=("bold", 5), fg="yellow", bd=0, bg="green", command=run_gn_cyan_atas_file)
Gn_Cyan_Atas_btn.place(x=3, y=150)
Gn_Cyan_Atas_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_Cyan_Atas_indicate.place(x=2, y=155, width=5, height=45)
Gn_A_Bass_btn = tk.Button(options_frame, text="Gn_A_Bass", font=("bold", 7), fg="yellow", bd=0, bg="grey", command=run_gn_a_bass_file)
Gn_A_Bass_btn.place(x=3, y=200)
Gn_A_Bass_indicate = tk.Label(options_frame, text=" ", bg="#c3c3c3")
Gn_A_Bass_indicate.place(x=2, y=205, width=5, height=45)
# Tombol untuk memilih nada
select_button = tk.Button(bottom_frame, text="Pilih Nada", bg="green", fg="white", command=pilih_nada)
select_button.grid(row=5, column=1, padx=5, pady=5)
separator = ttk.Separator(bottom_frame, orient='horizontal')
separator.grid(row=6, column=0, sticky="ew", pady=15)
# Fungsi untuk Naik ke Gn_Cyan_Atas (file CRUD_Gn_Cyan_Atas(gabung).py, atau Turum ke Gn_A_Trebel (file CRUD_Gn_A_Trebel.py)
active_page = None # Menyimpan halaman aktif
def next_to_crud_gn_cyan_atas():
filepath = "CRUD_Gn_Cyan_Atas(gabung).py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
def next_to_crud_gn_a_trebel():
filepath = "CRUD_Gn_A_Trebel.py"
try:
with open(filepath, 'r') as file:
exec(file.read(), globals())
messagebox.showinfo("Success", "File executed successfully")
except Exception as e:
messagebox.showerror("Error", f"Failed to execute file: {e}")
#Fungsi Tombol Ambil Gugusan nada Teroilih
copy_bass_gn_cyan_bawah_btn = tk.Button(bottom_frame, text="Copy Bass", command=None, bg="lightgreen", fg="blue")
copy_bass_gn_cyan_bawah_btn.grid(row=9, column=1, padx=10, pady=5)
copy_bass_sub_gn_cyan_bawah_btn = tk.Button(bottom_frame, text="Copy Sub_Bass", command=None, bg="lightgreen", fg="blue")
copy_bass_sub_gn_cyan_bawah_btn.grid(row=9, column=2, padx=10, pady=5)
copy_trebel_gn_cyan_bawah_btn = tk.Button(bottom_frame, text="Copy Trebel", command=None, bg="lightgreen", fg="blue")
copy_trebel_gn_cyan_bawah_btn.grid(row=9, column=3, padx=10, pady=5)
copy_trebel_sub_gn_cyan_bawah_btn = tk.Button(bottom_frame, text="Copy Sub_Trebel", command=None, bg="lightgreen", fg="blue")
copy_trebel_sub_gn_cyan_bawah_btn.grid(row=9, column=4, padx=10, pady=5)
separator = ttk.Separator(bottom_frame, orient='horizontal')
separator.grid(row=10, column=0, sticky="ew", pady=15)
prev_btn = tk.Button(bottom_frame, text="< Prev", command=None, bg="orange", fg="white")
prev_btn.grid(row=12, column=0, padx=10, pady=5)
naik_btn = tk.Button(bottom_frame, text=" Naik Lagi > ", command=next_to_crud_gn_cyan_atas, bg="orange", fg="white")
naik_btn.grid(row=11, column=1, padx=10, pady=5)
turun_btn = tk.Button(bottom_frame, text="Turun Lagi >", command=next_to_crud_gn_a_trebel, bg="orange", fg="white")
turun_btn.grid(row=12, column=1, padx=10, pady=5)
# Inisialisasi database
init_db()
# Main Function
if __name__ == "__main__":
init_default_page()
root.mainloop()
Komentar
Posting Komentar
This Message