Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import * #imports
- from tkinter import Tk
- from tkinter.filedialog import askopenfilename
- win = Tk() #create instance
- win.title("Spatialization of DSSAT model")
- w = 160 # width for the Tk root
- h = 100 # height for the Tk root
- # get screen width and height
- ws = win.winfo_screenwidth() # width of the screen
- hs = win.winfo_screenheight() # height of the screen
- # calculate x and y coordinates for the Tk root window
- x = (ws/2) - (w/2)
- y = (hs/2) - (h/2)
- # set the dimensions of the screen
- # and where it is placed
- win.geometry('%dx%d+%d+%d' % (w, h, x, y))
- def var_states():
- print("soil: %d, nweather:%d" % (var1.get(), var2.get()))
- Label(win, text="Select:").grid(row=0, sticky=W)
- var1 = IntVar()
- Checkbutton(win, text = "soil", variable=var1).grid(row=1, sticky=W)
- var2 = IntVar()
- Checkbutton(win, text = "weather", variable=var2).grid(row=2, sticky=W)
- MyButton1 = Button(win, text="Submit", width=10)
- MyButton1.grid(row=10, column=10)
- Tk().withdraw()
- filename1 = askopenfilename()
- print(filename1)
- Tk().withdraw()
- filename2 = askopenfilename()
- print(filename2)
- win.mainloop() #start the GUI
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement