Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Made in python version 3.7.1
- ##All works but needs Money/Uranium adding to be done when "calculate" is pressed
- from tkinter import *
- from tkinter import ttk
- import tkinter as tk
- import tkinter.messagebox
- import time
- overallproduction=0
- uranium=0
- #window
- root = tk.Tk()
- root.title("Zarp Calculator")
- root.configure(background="light green")
- root.geometry("350x290")
- #Unused so no other files needed
- #root.iconbitmap("Zarplogo.ico")
- root.resizable(width=False, height=False)
- #Labels
- printerlabel= Label(root, text="Money printer", padx=22)
- printerlabel.place(x = 205, y = 10)
- allprinters= Label(root, text="All printers", padx=32)
- allprinters.place(x = 20, y = 10)
- #The Listbox for printers
- List1= Listbox(root,width=20,height=10)
- List1.insert(1,"Topaz Printer")
- List1.insert(2,"Amethyst Printer")
- List1.insert(3,"Emerald Printer")
- List1.insert(4,"Sapphire Printer")
- List1.insert(5,"Normal Printer")
- List1.insert(6,"Ruby Printer")
- List1.insert(7,"Gold Printer")
- List1.insert(8,"Nuclear Printer")
- List1.insert(9,"Diamond Printer")
- List1.insert(10,"Black Diamond Printer")
- List1.insert(11,"Gencorp Printer")
- List1.insert(12,"Magik Printer")
- List1.insert(13,"Iridium Printer")
- List1.insert(14,"Festive Printer")
- List1.insert(15,"Ice Printer")
- List1.insert(16,"Skull Printer")
- List1.insert(17,"Golden plated Printer")
- List1.insert(18,"Uranium Printer")
- List1.place(x = 20, y = 40)
- #Selected printers
- List2= Listbox(root)
- List2.place(x=205, y=40)
- #Add printer to List2
- def Addprinter():
- clicked_items=List1.curselection()
- for item in clicked_items:
- b=(List1.get(item))
- List2.insert(clicked_items,b)
- #Remove printer from List2
- def del_printer():
- selected_printer =List2.curselection()
- if len(selected_printer)==0:
- selected_printer="0"
- selected_printer = int(selected_printer[0])
- List2.delete(selected_printer)
- #Multiplier radiobuttons
- multipliervalue=tk.IntVar()
- Radiobutton(root,text="1x",value = 1,variable=multipliervalue).place(x=155,y=40)
- Radiobutton(root,text="2x",value = 2,variable=multipliervalue).place(x=155,y=75)
- Radiobutton(root,text="3x",value = 3,variable=multipliervalue).place(x=155,y=110)
- Radiobutton(root,text="4x",value = 4,variable=multipliervalue).place(x=155,y=145)
- Radiobutton(root,text="5x",value = 5,variable=multipliervalue).place(x=155,y=180)
- #Finds profit/hour
- totalproduction="$",overallproduction,"and",uranium,"uranium"
- #Calculate function
- def calculate():
- tkinter.messagebox.showinfo("Hourly profit",totalproduction)
- #Calculate button
- calculatebutton = Button(root, text="Calculate",command=calculate, padx=50)
- calculatebutton.place (x=100, y=250)
- #Confermation button
- printerbutton = Button(root, text="Select Printer", padx=23, command=Addprinter)
- printerbutton.place(x=20, y=210)
- #Delete button
- deletebutton = Button(root, text="Remove Printer", padx=18, command = del_printer)
- deletebutton.place (x=205, y=210)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement