Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import *
- window = Tk()
- window.title('Button Project')
- #window = tk.Canvas(window, height=500, width=500, bg="black") can use this to create a canvas, if you do, make sure to do window.pack() to complete it
- window.geometry('300x200')
- Label(window, text='Select the ammo you would like to scan') .grid(row=0, column=0, sticky=W)
- #import imrunning this will run the whole imrunning.py on startup. The exec command will run when its called.
- #exec(open('imrunning.py').read())
- #value1= exec(open('imrunning.py').read())#This will call imrunning.py and run it. Can also call induvidual functions using the import function
- chkbutton_1 = Checkbutton(window, text="9mm below .50cents", onvalue=1, offvalue=2) .grid(row=1, column=0, sticky=W)
- #value2=exec(open('imalsorunning.py') .read())
- chkbutton_2 = Checkbutton(window, text=".223 below .50cents", onvalue=1, offvalue=2) .grid(row=2, column=0, sticky=W)
- output = Text(window, width=35, height=4, wrap=WORD, bg="white")
- output.grid(row=5, column=0, columnspan=2, sticky=W)
- def enter_check(): #these define what the command function is in the Button functions.
- output.insert(END, 'Pressed\n')
- enterButton = Button(window, text="Enter", width=4, command=enter_check) .grid(row=3, column=0, sticky=W)
- def close_window():
- window.destroy()
- exit()
- exitButton = Button(window, text="Exit", width=4, command=close_window) .grid(row=3, column=0, sticky=E)
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement