Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

import tkinter as tk

from tkinter import ttk

from tkinter import Label, Entry, Button

root = tk.Tk()

root.title('PROGRAM PENGGAJIAN')

root.geometry('450x350')

lbl1 = Label(root, text="N IDN", font="arial 12 bold")

lbl1.place(x=10, y=10)

lbl2 = Label(root, text="NAMA DOSEN", font="arial 12 bold")

lbl2.place(x=10, y=50)

lbl3 = Label(root, text="PANGKAT AKADEMIK", font="arial 12 bold")

lbl3.place(x=10, y=90)

lbl4 = Label(root, text="GAJI POKOK", font="arial 12 bold")

lbl4.place(x=10, y=130)

lbl5 = Label(root, text="TUNJ. PANG. AKAD", font="arial 12 bold")


lbl5.place(x=10, y=170)

lbl6 = Label(root, text="TOTAL GAJI", font="arial 12 bold")

lbl6.place(x=10, y=210)

def proses(event):

edit1.delete(0, 'end')

edit2.delete(0, 'end')

edit3.delete(0, 'end')

selected = event.widget.get()

combobox_values = {'001': ('BUDIYANTO'), '002': ('RUDYANTO'), '003': ('SUPRIYANTO')}

for item in combobox_values[selected]:

edit1.insert('end', item)

if edit1.get() == 'BUDIYANTO':

edit2.insert(0, 'LEKTOR')

edit3.insert(0, '6500000')

if edit1.get() == 'RUDYANTO':

edit2.insert(0, 'ASISTEN AHLI')

edit3.insert(0, '5500000')

if edit1.get() == 'SUPRIYANTO':
edit2.insert(0, 'TENAGA PENGAJAR')

edit3.insert(0, '3500000')

combobox = ttk.Combobox(root, width=12, font="arial 12 bold", values=['001', '002', '003'])

combobox.place(x=190, y=10)

combobox.bind('<<ComboboxSelected>>', proses)

edit1 = Entry(root, width=27, font="arial 12 bold")

edit1.place(x=190, y=50)

edit2 = Entry(root, width=20, font="arial 12 bold")

edit2.place(x=190, y=90)

edit3 = Entry(root, width=15, font="arial 12 bold")

edit3.place(x=190, y=130)

edit4 = Entry(root, width=15, font="arial 12 bold")

edit4.place(x=190, y=170)

edit5 = Entry(root, width=15, font="arial 12 bold")

edit5.place(x=190, y=210)
def calculate():

edit4.delete(0, 'end')

edit5.delete(0, 'end')

if edit3.get() == '6500000':

edit4.insert(0, int(edit3.get()) * (50 / 100))

edit5.insert(0, int(edit3.get()) + float(edit4.get()))

if edit3.get() == '5500000':

edit4.insert(0, int(edit3.get()) * (40 / 100))

edit5.insert(0, int(edit3.get()) + float(edit4.get()))

if edit3.get() == '3500000':

edit4.insert(0, '0')

edit5.insert(0, '3500000')

btn1 = Button(root, text="PROSES", font="arial 12 bold", height=2, width=12, command=calculate)

btn1.place(x=20, y=280)

def clear():

combobox.set('')

edit1.delete(0, 'end')

edit2.delete(0, 'end')
edit3.delete(0, 'end')

edit4.delete(0, 'end')

edit5.delete(0, 'end')

btn2 = Button(root, text="CLEAR", font="arial 12 bold", height=2, width=12, command=clear)

btn2.place(x=160, y=280)

def quit_app():

root.destroy()

btn3 = Button(root, text="CLOSE", font="arial 12 bold", height=2, width=12, command=quit_app)

btn3.place(x=300, y=280)

root.mainloop()

You might also like