def initUI(self): # Style().configure("TButton", padding=(10, 10, 10, 10), # font='serif 8', weight=1) mri = Image.open("mri.jpg") # mri.resize((w, h), Image.ANTIALIAS) background_image=ImageTk.PhotoImage(mri) background_label = Label(self, image=background_image) background_label.photo=background_image background_label.place(x=0, y=0, relheight=1) self.columnconfigure(0, pad=10, weight=1) self.columnconfigure(1, pad=10, weight=1) self.columnconfigure(2, pad=20, weight=1) self.rowconfigure(0, pad=20, weight=1) self.rowconfigure(1, pad=20, weight=1) self.rowconfigure(2, pad=20, weight=1) self.customFont = tkFont.Font(family="Helvetica", size=15) # Style().configure('green/black.TButton', foreground='yellow', background=tk_rgb, activefill="red",font=self.customFont) entry = Entry(self) #TODO: REMOVE? f = open('games.txt') buttonArray = [] for i, line in enumerate(f): line = line.split(':') filename = line[0].translate(None, ' \n').lower() imagefile = Image.open(filename + "-thumbnail.png") image = ImageTk.PhotoImage(imagefile) label1 = Label(self, image=image) label1.image = image # + "\n" + line[1] tk_rgb = "#%02x%02x%02x" % (100+35*(i%5), 50+100*(i%3), 70+80*(i%2)) button = (Button(self, text=line[0], image=image, compound="bottom", bd=0, bg=tk_rgb, font=self.customFont, command = lambda filename=filename :os.system("python " + filename + ".py"))) button.grid(row=i/3, column=i%3) f.close() self.pack(fill=BOTH, expand=1)
def bigger_preview(): image = Image.open( get_image_from_internet_binary( u"%s%s" % (main_url, self.current_image[u"file_url"]))) photo = ImageTk.PhotoImage(image) self.bigpreview = Toplevel(self) labelu = Label(self.bigpreview, image=photo) labelu.image = photo labelu.pack(fill=Y, expand=0, side=LEFT)
def initUI(self): self.parent.title("Story Creator") self.columnconfigure(0, pad=0) self.columnconfigure(1, pad=0) self.rowconfigure(0, pad=0) self.grid(row=0, column=0) logo = ImageTk.PhotoImage(Image.open("prelaunch_logo.png")) logolabel = Label(self, image=logo) logolabel.image = logo logolabel.grid(row=0, column=0)
def initUI(self): self.parent.title("Pythagram: Photo") self.style = Style() self.style.theme_use("default") raw = self.api.call_resource('media', 'info', media_id=self.id) data = raw['data'] #Photo f = WebFetch() photoFrame = Frame(self, relief=RAISED) photoFrame.pack(fill=BOTH, expand=1) photoUrl = "http://photos-d.ak.instagram.com/hphotos-ak-frc/" + data['images']['thumbnail']['url'].replace("http:http://origincache-frc.fbcdn.netorigincache-frc.fbcdn.net/","") profpict = Image.open(f.retrieve(photoUrl)) profilePicture = ImageTk.PhotoImage(profpict) label2 = Label(photoFrame, image=profilePicture) label2.image = profilePicture label2.pack(padx=5, pady=5) #Photo info infoFrame = Frame(self,relief=RAISED) infoFrame.pack(fill=BOTH, expand=1) try: info = Label(infoFrame, text=data['caption']['text']) except: info = Label(infoFrame, text="") info.pack(side=LEFT, padx=5, pady=5) #People who liked likesFrame = Frame(self,relief=RAISED) likesFrame.pack(fill=BOTH, expand=1) likeLabel = Label(likesFrame, text="Likes:") likeLabel.pack() proto_likes = data['likes']['data'] self.likes = [] lb = Listbox(likesFrame, width=100) for element in proto_likes: try: lb.insert(END, "@{0}: {1}".format(element['username'],element['full_name'])) except: continue self.likes.append(element['id']) lb.bind("<<ListboxSelect>>", self.onSelect) lb.pack(side=LEFT, padx=5, pady=5) self.pack(fill=BOTH, expand=1)
def createui(self): image = Image.open('header.png') photo = ImageTk.PhotoImage(image) lbl = Label(self, image=photo) lbl.image = photo lbl.grid(row=0, column=0, columnspan=2, sticky='ns') self.treeview = Treeview(self) self.treeview['columns'] = ['title'] self.treeview.heading("#0", text='Repeticiones', anchor='center') self.treeview.column("#0", anchor="center", width=90) self.treeview.heading('title', text='Titulo', anchor='w') self.treeview.column('title', anchor='w', width=700) self.treeview.grid(sticky=(N, S, W, E)) self.treeview.bind("<Double-1>", self.openlink) ysb = Scrollbar(self, width=18, orient='vertical', command=self.treeview.yview) ysb.grid(row=1, column=1, sticky='ns') self.treeview.configure(yscroll=ysb.set) self.grid_rowconfigure(1, weight=1) self.grid_columnconfigure(0, weight=1)
def initUI(self): self.parent.title("Buttons") self.style=Style() self.style.theme_use("default") frame = Frame(self, relief=RAISED, borderwidth=1) frame.pack(fill=BOTH, expand=1) bard = Image.open("images.jpg") bardejov = ImageTk.PhotoImage(bard) label1 = Label(frame, image=bardejov) label1.image = bardejov label1.place(x=20, y=20) self.pack(fill=BOTH, expand=1) closebutton = Button(self, text="Close") closebutton.pack(side=RIGHT, padx=5, pady=5) okbutton = Button(self, text="OK") okbutton.pack(side=RIGHT)
def __init__(self, root): register_openers() Tkinter.Frame.__init__(self, root) self.root = root self.root.title("GoData Client Module") self.grid() Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.root.columnconfigure(0, pad=3) self.root.columnconfigure(1, pad=3) self.root.columnconfigure(2, pad=3) self.root.columnconfigure(3, pad=3) self.root.columnconfigure(4, pad=3) self.root.rowconfigure(0, pad=3) self.root.rowconfigure(1, pad=3) self.root.rowconfigure(2, pad=3) self.root.rowconfigure(3, pad=3) self.root.rowconfigure(4, pad=3) self.root.rowconfigure(5, pad=3) self.root.rowconfigure(6, pad=3) self.root.rowconfigure(7, pad=3) self.root.rowconfigure(8, pad=3) self.root.rowconfigure(9, pad=3) self.root.rowconfigure(10, pad=3) self.root.rowconfigure(11, pad=3) self.root.rowconfigure(12, pad=3) self.root.rowconfigure(13, pad=3) self.root.rowconfigure(14, pad=3) self.root.rowconfigure(15, pad=3) self.root.rowconfigure(16, pad=3) self.root.rowconfigure(17, pad=3) self.root.rowconfigure(18, pad=3) self.root.rowconfigure(19, pad=3) self.root.rowconfigure(20, pad=3) self.root.rowconfigure(21, pad=3) self.root.rowconfigure(22, pad=3) self.root.rowconfigure(0, weight=1) self.root.columnconfigure(0, weight=1) global e e = Entry(self, width=4) e.grid(row=16, column=4) e.focus_set() #self.button = Button(self, text="Upload", fg="red", command=self.logout) #self.button.pack(side = RIGHT) button_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5} a = Tkinter.Button(self, text='Browse', command=self.askopenfilename)#.pack(**button_opt) a.grid(row =1 , column =4) b = Tkinter.Button(self, text='Upload', command=self.upload)#.pack(**button_opt) b.grid(row = 3, column =4) f=client.doCmd({"cmd":"view"}) for i in f: FileInfo[i.split(":")[0]].append(i.split(":")[1].split("/")[-1]) print FileInfo t = SimpleTable(self, len(f)/5,5) t.grid(row = 4, column =4) #MyButton1 = Button(self, text="Download 5", width=14, command=self.Download) #MyButton1.grid(row=15, column=4) #MyButton2 = Button(self, text="Download 6", width=14, command=self.Download) #MyButton2.grid(row=15, column=5) #MyButton3 = Button(self, text="Download 7", width=14, command=self.Download) #MyButton3.grid(row=15, column=6) #MyButton4 = Button(self, text="Download 4", width=14, command=self.Download) #MyButton4.grid(row=15, column=3) #MyButton5 = Button(self, text="Download 3", width=14, command=self.Download) #MyButton5.grid(row=15, column=2) #MyButton6 = Button(self, text="Download 2", width=14, command=self.Download) #MyButton6.grid(row=15, column=1) #MyButton7 = Button(self, text="Download 1", width=14, command=self.Download) #MyButton7.grid(row=15, column=0) #MyButton8 = Button(self, text="Download 8", width=14, command=self.Download) #MyButton8.grid(row=15, column=7) MyButton9 = Button(self, text="Download", width=14, command=self.callback) MyButton9.grid(row=17, column=4) creation = tk.Label( self, text = "Created by Kuber, Digvijay, Anahita & Payal", borderwidth =5, width =45) creation.grid(row=50 , column = 4) self.file_opt = options = {} options['defaultextension'] = '.txt' options['filetypes'] = [('all files', '.*'), ('text files', '.txt')] options['initialdir'] = 'C:\\' options['initialfile'] = 'myfile.txt' options['parent'] = root options['title'] = 'Browse' self.dir_opt = options = {} options['initialdir'] = 'C:\\' options['mustexist'] = False options['parent'] = root options['title'] = 'Browse' image = Image.open("./header.png") photo = ImageTk.PhotoImage(image) label = Label(image=photo) label.image = photo # keep a reference! label.place(width=768, height=576) label.grid(row = 0 , column = 0 ) label.pack(side = TOP) self.centerWindow() self.master.columnconfigure(10, weight=1) #Tkinter.Button(self, text='upload file', command=self.Fname).pack(**button_opt) t = self.file_name = Text(self, width=39, height=1, wrap=WORD) t.grid(row = 2, column =4) extra1 = tk.Label(self, text = "please give a file number", borderwidth = 5, width =45) extra1.grid(row =15, column =4)
def initUI(self): self.parent.title("LINEARITY TEST FOR PMT BASES") self.pack(fill=BOTH, expand=True) self.columnconfigure(0, weight=1) #self.rowconfigure(0, weight=1) # weight attibute is used to make them growable # self.graph_cb = BooleanVar() self.init_point = IntVar() self.base_path = StringVar() self.end_point = IntVar() self.step = IntVar() self.n_meas = IntVar() self.inc_point = IntVar() self.coef = DoubleVar() self.noise = DoubleVar() self.thr_sigma = DoubleVar() self.SPE_DAQ = DoubleVar() search = Image.open("next_logo.jpg") search_temp = search.resize((170, 200), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=0, columnspan=10, rowspan=10, sticky=E+W+S+N) #Text Box self.base_path.set("F:/DATOS_DAC/2052/pmt_0_trace_evt_") e1 = Entry(self, textvariable=self.base_path, width=40) e1.grid(row=1,column=2, sticky=W, columnspan=5, pady=5) e1_label = Label(self, text="DataSet path (including name file)") e1_label.grid(row=0,column=2,sticky=W, columnspan=5, pady=5) #Spin Boxes self.n_meas.set("20") sb1 = Spinbox(self, from_=1, to=1000, width=6, textvariable=self.n_meas) sb1.grid(row=3,column=3, sticky=W) sb1_label = Label(self, text="Measurements") sb1_label.grid(row=2,column=3, padx=0, sticky=W) self.step.set("10") sb2 = Spinbox(self, from_=10, to=200, width=6, textvariable=self.step) sb2.grid(row=3,column=4, sticky=W) sb2_label = Label(self, text="Pulse Width Step") sb2_label.grid(row=2,column=4, padx=0, sticky=W) # INTEGRATION LIMITS Integration_label = Label(self, text="INTEGRATION LIMITS", font = "Verdana 12 bold") Integration_label.grid(row=4,column=3, padx=5, columnspan = 3, pady=10) self.init_point.set("30") sb3 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.init_point) sb3.grid(row=7,column=3, sticky=W) sb3_label = Label(self, text="Start (usec)") sb3_label.grid(row=6,column=3, padx=0, sticky=W) self.end_point.set("160") sb4 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.end_point) sb4.grid(row=7,column=4, sticky=W) sb4_label = Label(self, text="End (usec)") sb4_label.grid(row=6,column=4, padx=0, sticky=W) # PARAMETERS Integration_label = Label(self, text="PARAMETERS", font = "Verdana 12 bold") Integration_label.grid(row=8,column=3, padx=5, columnspan = 3, pady=10) self.inc_point.set("3") sb5 = Spinbox(self, from_=1, to=100, width=6, textvariable=self.inc_point) sb5.grid(row=11,column=3, sticky=W) sb5_label = Label(self, text="First point") sb5_label.grid(row=10,column=3, padx=0, sticky=W) self.coef.set("1.636E-3") e6 = Entry(self, width=10, textvariable=self.coef) e6.grid(row=11,column=4, sticky=W) e6_label = Label(self, text="DBLR Coef") e6_label.grid(row=10,column=4, sticky=W) self.noise.set("0.75") e7 = Entry(self, width=10, textvariable=self.noise) e7.grid(row=11,column=5, sticky=W) e7_label = Label(self, text="Noise (LSB)") e7_label.grid(row=10,column=5, sticky=W) self.thr_sigma.set("40") e8 = Entry(self, width=10, textvariable=self.thr_sigma) e8.grid(row=13,column=3, sticky=W) e8_label = Label(self, text="Threshold") e8_label.grid(row=12,column=3, sticky=W) self.SPE_DAQ.set("20.5") e9 = Entry(self, width=10, textvariable=self.SPE_DAQ) e9.grid(row=13,column=4, sticky=W) e9_label = Label(self, text="SPE (LSB)") e9_label.grid(row=12,column=4, sticky=W) # #Check buttons # cb1 = Checkbutton(self, text="MultiGraph Output", variable=self.graph_cb ) # cb1.select() # cb1.grid(row=7,column=6, sticky=W) # Main buttons obtn = Button(self, text="GO!!", command=self.linearity_f) obtn.grid(row=14, column=4, sticky=E, pady=10) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=14, column=5, sticky=E, pady=10) hbtn = Button(self, text="Help") hbtn.grid(row=14, column=0, sticky=W, pady=10)
def initUI(self): self.parent.title("DBLR for Dummies") self.pack(fill=BOTH, expand=True) #self.columnconfigure(0, weight=1) #self.rowconfigure(0, weight=1) # weight attibute is used to make them growable self.meas = IntVar() self.point = IntVar() self.base_path = StringVar() self.coef = DoubleVar() self.noise = DoubleVar() self.n_sigma = DoubleVar() self.thr1 = DoubleVar() self.thr2 = DoubleVar() self.thr3 = DoubleVar() self.graph_sw = BooleanVar() #Image factor=0.65 search = Image.open("NEXT_official_logo.jpg") width_org, height_org = search.size search_temp = search.resize((int(width_org*factor), int(height_org*factor)), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=4, columnspan=2, rowspan=3, padx=5) #self.base_path.set("F:/DATOS_DAC/2052/pmt_0_trace_evt_") self.base_path.set("Argon.h5.z") e1 = Entry(self, textvariable=self.base_path, width=40) e1.grid(row=0,column=1, sticky=W, columnspan=3, pady=5, padx=5) e1_label = Label(self, text="Path & Name") e1_label.grid(row=0,column=0, columnspan=1, sticky=E, pady=5, padx=5) self.point.set("0") sb1 = Spinbox(self, from_=0, to=100, width=4, textvariable=self.point) sb1.grid(row=2,column=1, sticky=W, pady=5, padx=5) sb1_label = Label(self, text="PMT") sb1_label.grid(row=2,column=0, padx=5, sticky=E) self.meas.set("0") sb1 = Spinbox(self, from_=0, to=100, width=4, textvariable=self.meas) sb1.grid(row=2,column=3, sticky=W, pady=5, padx=5) sb1_label = Label(self, text="Event") sb1_label.grid(row=2,column=2, padx=5, sticky=E) #Check buttons # cb1 = Checkbutton(self, text="New Graph", variable=self.graph_sw) # cb1.select() # cb1.grid(row=2,column=2, sticky=W) #PARAMETERS Integration_label = Label(self, text="PARAMETERS", font = "Verdana 12 bold") Integration_label.grid(row=3,column=1, padx=5, columnspan = 2, pady=10, sticky=E) self.coef.set("1.65E-3") e2 = Entry(self, width=12, textvariable=self.coef) e2.grid(row=4,column=1, sticky=W, pady=5, padx=5) e2_label = Label(self, text="DBLR Coef") e2_label.grid(row=4,column=0, sticky=E, pady=5, padx=5) self.noise.set("0.75") e3 = Entry(self, width=12, textvariable=self.noise) e3.grid(row=4,column=3, sticky=W, pady=5, padx=5) e3_label = Label(self, text="Noise (LSB)") e3_label.grid(row=4,column=2, sticky=E, pady=5, padx=5) self.n_sigma.set("4") e4 = Entry(self, width=12, textvariable=self.n_sigma) e4.grid(row=4,column=5, sticky=W, pady=5, padx=5) e4_label = Label(self, text="Noise Threshold") e4_label.grid(row=4,column=4, sticky=E, pady=5, padx=5) self.thr1.set("0") e5 = Entry(self, width=12, textvariable=self.thr1) e5.grid(row=5,column=1, sticky=W, pady=5, padx=5) e5_label = Label(self, text="Threshold 1") e5_label.grid(row=5,column=0, sticky=E, pady=5, padx=5) self.thr2.set("0") e6 = Entry(self, width=12, textvariable=self.thr2) e6.grid(row=5,column=3, sticky=W, pady=5, padx=5) e6_label = Label(self, text="Threshold 2") e6_label.grid(row=5,column=2, sticky=E, pady=5, padx=5) self.thr3.set("0") e7 = Entry(self, width=12, textvariable=self.thr3) e7.grid(row=5,column=5, sticky=W, pady=5, padx=5) e7_label = Label(self, text="Threshold 3") e7_label.grid(row=5,column=4, sticky=E, pady=5, padx=5) # Main buttons obtn = Button(self, text="GO!!", command=self.DBLR_f) obtn.grid(row=6, column=4, sticky=E, pady=10) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=6, column=5, sticky=E, pady=10) hbtn = Button(self, text="Help", command=self.help_f) hbtn.grid(row=6, column=0, sticky=W, pady=10)
def initUI(self): self.parent.title("FIND SPE VALUE") self.pack(fill=BOTH, expand=True) self.columnconfigure(0, weight=1) #self.rowconfigure(0, weight=1) # weight attibute is used to make them growable self.graph_cb = BooleanVar() self.bins = IntVar() self.path = StringVar() self.n_files = IntVar() self.start_s = IntVar() self.end_s = IntVar() self.guess = IntVar() search = Image.open("next_logo.jpg") search_temp = search.resize((160, 200), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=0, columnspan=10, rowspan=10, sticky=E+W+S+N) #Number of Files and Bins. Spin Box self.n_files.set("2000") sb1 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.n_files) sb1.grid(row=1,column=4, sticky=W) sb1_label = Label(self, text="Files") sb1_label.grid(row=1,column=3, padx=5, sticky=E) self.bins.set("50") sb2 = Spinbox(self, from_=10, to=200, width=6, textvariable=self.bins) sb2.grid(row=1,column=6, sticky=W) sb2_label = Label(self, text="Hist. Bins") sb2_label.grid(row=1,column=5, padx=5, sticky=E) # INTEGRATION LIMITS Integration_label = Label(self, text="INTEGRATION", font = "Verdana 12 bold") Integration_label.grid(row=3,column=4, padx=5, columnspan = 2) self.start_s.set("1732") sb3 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.start_s) sb3.grid(row=4,column=4, sticky=W) sb3_label = Label(self, text="StartPoint") sb3_label.grid(row=4,column=3, padx=5, sticky=E) self.end_s.set("1752") sb4 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.end_s) sb4.grid(row=4,column=6, sticky=W) sb4_label = Label(self, text="EndPoint") sb4_label.grid(row=4,column=5, padx=5, sticky=E) sb4_label = Label(self, text="") sb4_label.grid(row=4,column=7, padx=5, sticky=E) # FITTING PARAMETERS Integration_label = Label(self, text="FITTING", font = "Verdana 12 bold") Integration_label.grid(row=6,column=4, padx=5, columnspan = 2) self.guess.set("-20") sb5 = Spinbox(self, from_=-50, to=-1, width=6, textvariable=self.guess) sb5.grid(row=7,column=4, sticky=W) sb5_label = Label(self, text="SPE guess") sb5_label.grid(row=7,column=5, padx=5, sticky=W) #Check buttons cb1 = Checkbutton(self, text="MultiGraph Output", variable=self.graph_cb ) cb1.select() cb1.grid(row=7,column=6, sticky=W) #Text Box #self.path.set("F:/DATOS_DAC/spe_1230/2046/pmt_0_trace_evt_") self.path.set("spe_1230_2046.h5.z") e1 = Entry(self, textvariable=self.path, width=45) e1.grid(row=10,column=3, sticky=W, columnspan=10, padx=10, pady=5) e1_label = Label(self, text="DataSet path (including name file)") e1_label.grid(row=9,column=3,sticky=W, columnspan=10, padx=10) # Main buttons obtn = Button(self, text="GO!!", command=self.SPE_f) obtn.grid(row=14, column=5, sticky=E, pady=5) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=14, column=6, sticky=E, pady=5) hbtn = Button(self, text="Help") hbtn.grid(row=14, column=0, sticky=W, pady=5)
def initUI(self): self.parent.title("FIND BLR COEFFICIENT VALUE") self.pack(fill=BOTH, expand=True) self.columnconfigure(0, weight=1) # self.rowconfigure(0, weight=1) # weight attibute is used to make them growable ###### GUI Control Variables ###### self.LIMIT_L = IntVar() self.LIMIT_H = IntVar() self.PULSE_R = IntVar() self.PULSE_L = IntVar() self.pulse_height = DoubleVar() self.hdf5_file = StringVar() self.PMT = IntVar() self.EVENT = IntVar() self.amplitude_range = DoubleVar() self.delta = DoubleVar() self.noise_sigma = DoubleVar() self.coeff = DoubleVar() #self.DRAW = BooleanVar() search = Image.open("next_logo.jpg") search_temp = search.resize((170, 200), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=0, columnspan=10, rowspan=10, sticky=E + W + S + N) self.hdf5_file.set("2052.h5.z") e1 = Entry(self, textvariable=self.hdf5_file, width=30) e1.grid(row=1, column=1, sticky=W, columnspan=5, pady=5) e1_label = Label(self, text="HDF5 file") e1_label.grid(row=0, column=1, sticky=W, columnspan=5, pady=5) self.PMT.set("0") sb1 = Spinbox(self, from_=0, to=12, width=3, textvariable=self.PMT) sb1.grid(row=3, column=2, sticky=W) sb1_label = Label(self, text="PMT") sb1_label.grid(row=2, column=2, padx=0, sticky=W) self.EVENT.set("0") sb1 = Spinbox(self, from_=0, to=1000, width=5, textvariable=self.EVENT) sb1.grid(row=3, column=3, sticky=W) sb1_label = Label(self, text="EVENT") sb1_label.grid(row=2, column=3, padx=0, sticky=W) self.LIMIT_L.set("19000") sb1 = Spinbox(self, from_=0, to=100000, width=5, textvariable=self.LIMIT_L) sb1.grid(row=5, column=2, sticky=W) sb1_label = Label(self, text="ROI Start ") sb1_label.grid(row=4, column=2, padx=0, sticky=W) self.LIMIT_H.set("22500") sb1 = Spinbox(self, from_=0, to=100000, width=5, textvariable=self.LIMIT_H) sb1.grid(row=5, column=3, sticky=W) sb1_label = Label(self, text="ROI End ") sb1_label.grid(row=4, column=3, padx=0, sticky=W) self.PULSE_R.set("20142") sb1 = Spinbox(self, from_=0, to=100000, width=8, textvariable=self.PULSE_R) sb1.grid(row=5, column=4, sticky=E) sb1_label = Label(self, text=" Pulse Rise") sb1_label.grid(row=4, column=4, padx=0, sticky=E) self.PULSE_L.set("1200") sb1 = Spinbox(self, from_=0, to=5000, width=8, textvariable=self.PULSE_L) sb1.grid(row=5, column=5, sticky=E) sb1_label = Label(self, text=" Pulse Length") sb1_label.grid(row=4, column=5, padx=0, sticky=E) sb1_label = Label(self, text=" ") sb1_label.grid(row=2, column=7, padx=0, sticky=W) sb1_label = Label(self, text=" ") sb1_label.grid(row=6, column=7, padx=0, sticky=W) self.pulse_height.set("545.5") sb1 = Entry(self, width=8, textvariable=self.pulse_height) sb1.grid(row=7, column=3, sticky=E) sb1_label = Label(self, text=" Amplitude") sb1_label.grid(row=6, column=3, padx=0, sticky=E) self.amplitude_range.set("2") sb1 = Entry(self, width=8, textvariable=self.amplitude_range) sb1.grid(row=7, column=4, sticky=E) sb1_label = Label(self, text=" Loop Range") sb1_label.grid(row=6, column=4, padx=0, sticky=E) self.delta.set("0.1") sb1 = Entry(self, width=8, textvariable=self.delta) sb1.grid(row=7, column=5, sticky=E) sb1_label = Label(self, text=" Loop Delta") sb1_label.grid(row=6, column=5, padx=0, sticky=E) self.noise_sigma.set("4") sb1 = Entry(self, width=3, textvariable=self.noise_sigma) sb1.grid(row=5, column=6, sticky=E) sb1_label = Label(self, text=" Noise Threshold") sb1_label.grid(row=4, column=6, padx=0, sticky=E) sb_coeff_label = Label(self, text="Coefficient ") sb_coeff_label.grid(row=0, column=6, padx=0, sticky=E) self.sb_coeff = Label(self) self.sb_coeff.grid(row=1, column=6, padx=0, sticky=E) # MAIN BUTTONS obtn = Button(self, text="GO!!", command=self.find_C) obtn.grid(row=14, column=4, sticky=E, pady=10) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=14, column=5, sticky=E, pady=10) hbtn = Button(self, text="Help", command=self.help_f) hbtn.grid(row=14, column=0, sticky=W, pady=10)
def initUI(self): self.parent.title("DBLR for Dummies") self.pack(fill=BOTH, expand=True) #self.columnconfigure(0, weight=1) #self.rowconfigure(0, weight=1) # weight attibute is used to make them growable self.meas = IntVar() self.point = IntVar() self.base_path = StringVar() self.coef = DoubleVar() self.noise = DoubleVar() self.n_sigma = DoubleVar() self.thr1 = DoubleVar() self.thr2 = DoubleVar() self.thr3 = DoubleVar() self.graph_sw = BooleanVar() #Image factor = 0.65 search = Image.open("NEXT_official_logo.jpg") width_org, height_org = search.size search_temp = search.resize( (int(width_org * factor), int(height_org * factor)), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=4, columnspan=2, rowspan=3, padx=5) #self.base_path.set("F:/DATOS_DAC/2052/pmt_0_trace_evt_") self.base_path.set("Argon.h5.z") e1 = Entry(self, textvariable=self.base_path, width=40) e1.grid(row=0, column=1, sticky=W, columnspan=3, pady=5, padx=5) e1_label = Label(self, text="Path & Name") e1_label.grid(row=0, column=0, columnspan=1, sticky=E, pady=5, padx=5) self.point.set("0") sb1 = Spinbox(self, from_=0, to=100, width=4, textvariable=self.point) sb1.grid(row=2, column=1, sticky=W, pady=5, padx=5) sb1_label = Label(self, text="PMT") sb1_label.grid(row=2, column=0, padx=5, sticky=E) self.meas.set("0") sb1 = Spinbox(self, from_=0, to=100, width=4, textvariable=self.meas) sb1.grid(row=2, column=3, sticky=W, pady=5, padx=5) sb1_label = Label(self, text="Event") sb1_label.grid(row=2, column=2, padx=5, sticky=E) #Check buttons # cb1 = Checkbutton(self, text="New Graph", variable=self.graph_sw) # cb1.select() # cb1.grid(row=2,column=2, sticky=W) #PARAMETERS Integration_label = Label(self, text="PARAMETERS", font="Verdana 12 bold") Integration_label.grid(row=3, column=1, padx=5, columnspan=2, pady=10, sticky=E) self.coef.set("1.65E-3") e2 = Entry(self, width=12, textvariable=self.coef) e2.grid(row=4, column=1, sticky=W, pady=5, padx=5) e2_label = Label(self, text="DBLR Coef") e2_label.grid(row=4, column=0, sticky=E, pady=5, padx=5) self.noise.set("0.75") e3 = Entry(self, width=12, textvariable=self.noise) e3.grid(row=4, column=3, sticky=W, pady=5, padx=5) e3_label = Label(self, text="Noise (LSB)") e3_label.grid(row=4, column=2, sticky=E, pady=5, padx=5) self.n_sigma.set("4") e4 = Entry(self, width=12, textvariable=self.n_sigma) e4.grid(row=4, column=5, sticky=W, pady=5, padx=5) e4_label = Label(self, text="Noise Threshold") e4_label.grid(row=4, column=4, sticky=E, pady=5, padx=5) self.thr1.set("0") e5 = Entry(self, width=12, textvariable=self.thr1) e5.grid(row=5, column=1, sticky=W, pady=5, padx=5) e5_label = Label(self, text="Threshold 1") e5_label.grid(row=5, column=0, sticky=E, pady=5, padx=5) self.thr2.set("0") e6 = Entry(self, width=12, textvariable=self.thr2) e6.grid(row=5, column=3, sticky=W, pady=5, padx=5) e6_label = Label(self, text="Threshold 2") e6_label.grid(row=5, column=2, sticky=E, pady=5, padx=5) self.thr3.set("0") e7 = Entry(self, width=12, textvariable=self.thr3) e7.grid(row=5, column=5, sticky=W, pady=5, padx=5) e7_label = Label(self, text="Threshold 3") e7_label.grid(row=5, column=4, sticky=E, pady=5, padx=5) # Main buttons obtn = Button(self, text="GO!!", command=self.DBLR_f) obtn.grid(row=6, column=4, sticky=E, pady=10) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=6, column=5, sticky=E, pady=10) hbtn = Button(self, text="Help", command=self.help_f) hbtn.grid(row=6, column=0, sticky=W, pady=10)
def initUI(self,name,bio,prof_picture,full_name,followed,follows): self.parent.title("Pythagram: "+name) self.style = Style() self.style.theme_use("default") headerFrame = Frame(self,relief=RAISED) headerFrame.pack(fill=BOTH, expand=1) #Profile Picture f = WebFetch() prof_picture = "http://images.ak.instagram.com/profiles/" + prof_picture.replace('http:http://images.ak.instagram.comimages.ak.instagram.com/profilesprofiles/','') profpict = Image.open(f.retrieve(prof_picture)) profilePicture = ImageTk.PhotoImage(profpict) label2 = Label(headerFrame, image=profilePicture) label2.image = profilePicture label2.pack(side=LEFT,padx=5, pady=5) #ProfileName FullName = Label(headerFrame, text=full_name) FullName.pack(side=LEFT) #PersonalInfo bioFrame = Frame(self,relief=RAISED) bioFrame.pack(fill=BOTH, expand=1) bio = Label(bioFrame, text=bio) bio.pack(side=LEFT, padx=5, pady=5) #Followers/Following followFrame = Frame(self,relief=RAISED) followFrame.pack(fill=BOTH, expand=1) followersButton = Button(followFrame, text="Followers: "+str(followed), command=self.followed) followingButton = Button(followFrame, text="Following: "+str(follows), command=self.follows) followersButton.pack(side=LEFT, padx=5, pady=5) followingButton.pack(side=LEFT, padx=5, pady=5) #Follow/Unfollow global GlobalID if (self.id != GlobalID): joinFrame = Frame(self,relief=RAISED) joinFrame.pack(fill=BOTH, expand=1) if (self.api.call_resource('users','relationship', user_id=self.id)['data']['outgoing_status'] == "none"): followButton = Button(joinFrame, text="Follow", command=self.follow) followButton.pack(side=LEFT, padx=5, pady=5) else: unfollowButton = Button(joinFrame, text="Unfollow", command=self.unfollow) unfollowButton.pack(side=LEFT, padx=5, pady=5) #Photo List photoFrame = Frame(self,relief=RAISED) photoFrame.pack(fill=BOTH, expand=1) raw = self.api.call_resource('users', 'recent', user_id=self.id) data = raw['data'] lb = Listbox(photoFrame, width=100) self.photos = [] for element in data: try: lb.insert(END, element['caption']['text']) except: continue self.photos.append(element['id']) lb.bind("<<ListboxSelect>>", self.onSelect) lb.pack(side=LEFT, padx=5, pady=5) self.pack(fill=BOTH, expand=1) searchButton = Button(self, text="Search", command=self.search) searchButton.pack(side=RIGHT, padx=5, pady=5)
def setCard(self,cardnum,row,col): dodel = False if cardnum == -1: dodel = True cardnum = 1 card = Card(cardnum) f = Frame(self, height = card.height, width = card.width) if (row == 2 and self.client.player == 'p1') or (row == 3 and self.client.player == 'p2'): f.config(height = card.height+20) if self.client.player == 'p1': f.grid(row=row+1, column=col) else: f.grid(row=6-row, column=NUM_COLS-col) f.pack_propagate(0) self.fgrid[row][col] = f pic = Label(f) if row <= 2: card.flip() if self.client.player == 'p2': card.flip() pic.config(image=card.img) pic.image = card.img pic.row = row pic.col = col pic.card = card def clicked(pic,ins,card): if ins.state == 'taking' and not pic.isNone: if pic.card.number == ins.activeCard: endTime = time.time() ins.delta = round(endTime-self.startTime,2) print(ins.delta) print("Got in "+str(ins.delta)) ins.client.sendMessage('took,'+str(ins.delta)+','+str(ins.faultCount)) if not ins.multiplayer: ins.client.oppSendMessage('p2,took,20,0') ins.changeState('waiting') pic.pack_forget() ins.model[pic.row][pic.col].isNone = True elif ins.activeCardRow == -1 or not (pic.row <= 2) == (ins.activeCardRow <= 2): ins.faults[int(pic.row <= 2)] = 1 ins.faultCount = sum(ins.faults) elif ins.state == 'move-select-start': ins.movingPic = (pic.row, pic.col) print('moving card:') print(ins.movingPic) if (((self.client.player == 'p1' and pic.row > 2) or (self.client.player == 'p2' and pic.row <= 2))\ and not pic.isNone) or not ins.multiplayer: ins.infoLabel.config(text="Card chosen. Select destination.") ins.changeState('move-select-stop') else: ins.infoLabel.config(text="Can't move that. Select a different card to move.") ins.moveButton.config(text="Cancel") elif ins.state == 'move-select-stop': print('to:') print((pic.row, pic.col)) if ((self.client.player == 'p1' and pic.row <= 2) or (self.client.player == 'p2' and pic.row > 2))\ and not pic.isNone: ins.infoLabel.config(text="Illegal move. Select a different card to move.") else: ins.swapCards(self.movingPic,(pic.row, pic.col)) ins.infoLabel.config(text="Move completed. Select next card.") ins.changeState('move-select-start') f.bind("<Button-1>",lambda e,pic=pic,self=self,card=card:clicked(pic,self,card)) pic.bind("<Button-1>",lambda e,pic=pic,self=self,card=card:clicked(pic,self,card)) pic.pack(fill=BOTH) self.model[row][col] = pic if dodel: pic.pack_forget() self.model[row][col].isNone = True else: self.model[row][col].isNone = False
def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.press = None self.grid(sticky=tk.N+tk.E+tk.S+tk.W) self.load_frame() self.load_mip() self.plot_mip() # Create rotate checkbutton global var1 var1 = tk.BooleanVar() rotateButton = Checkbutton(self, text = "Rotate", variable = var1, command=self.checkbutton_value1) rotateButton.grid(row=1, column=0, sticky=tk.E) # Create click checkbutton global var2 var2 = tk.BooleanVar() clickButton = Checkbutton(self, text = "Click", variable = var2, command=self.checkbutton_value2) clickButton.grid(row=1, column=1) # Create quit button quitButton = Button(self, text="Quit", command=self.quit) quitButton.grid(row=0, column=0, sticky=tk.N+tk.W) # Create interpolate button interpolButton = Button(self, text="Interpolate!", command=self.interpolate) interpolButton.grid(row=3, column=0, sticky=tk.S+tk.W) # resetButton = Button(self, text="Reset", command=self.resett) # resetButton.grid(row=4,column=0) # Add CNT logo logo_path = '%s/logo.png'%(DATA_DIR) logo = Image.open(logo_path) logo = ImageTk.PhotoImage(logo) label1 = Label(self, image=logo) label1.grid(row=0, rowspan=4, column=4) label1.image = logo # Create labels and display boxes for selected points label_a = Label(self, text= "A:") label_a.grid(row=0, column=1, sticky=tk.E+tk.S) global coord_a coord_a = Entry(self) coord_a.grid(row=0, column=2, sticky=tk.W+tk.S) label_b = Label(self, text= "B:") label_b.grid(row=1, column=1, sticky=tk.E+tk.N) global coord_b coord_b = Entry(self) coord_b.grid(row=1, column=2, sticky=tk.W+tk.N) label_c = Label(self, text= "C:") label_c.grid(row=2, column=1, sticky=tk.E+tk.N) global coord_c coord_c = Entry(self) coord_c.grid(row=2, column=2, sticky=tk.W+tk.N) label_d = Label(self, text= "D:") label_d.grid(row=3, column=1, sticky=tk.E+tk.N) global coord_d coord_d = Entry(self) coord_d.grid(row=3, column=2, sticky=tk.W+tk.N) # Initialized count variable that will be used to regulate number of corners global count count = 0
def initUI(self): self.parent.title("FIND BLR COEFFICIENT VALUE") self.pack(fill=BOTH, expand=True) self.columnconfigure(0, weight=1) # self.rowconfigure(0, weight=1) # weight attibute is used to make them growable ###### GUI Control Variables ###### self.LIMIT_L = IntVar() self.LIMIT_H = IntVar() self.PULSE_R = IntVar() self.PULSE_L = IntVar() self.pulse_height = DoubleVar() self.hdf5_file = StringVar() self.PMT = IntVar() self.EVENT = IntVar() self.amplitude_range = DoubleVar() self.delta = DoubleVar() self.noise_sigma = DoubleVar() self.coeff = DoubleVar() #self.DRAW = BooleanVar() search = Image.open("next_logo.jpg") search_temp = search.resize((170, 200), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=0, columnspan=10, rowspan=10, sticky=E+W+S+N) self.hdf5_file.set("2052.h5.z") e1 = Entry(self, textvariable=self.hdf5_file, width=30) e1.grid(row=1,column=1, sticky=W, columnspan=5, pady=5) e1_label = Label(self, text="HDF5 file") e1_label.grid(row=0,column=1,sticky=W, columnspan=5, pady=5) self.PMT.set("0") sb1 = Spinbox(self, from_=0, to=12, width=3, textvariable=self.PMT) sb1.grid(row=3,column=2, sticky=W) sb1_label = Label(self, text="PMT") sb1_label.grid(row=2,column=2, padx=0, sticky=W) self.EVENT.set("0") sb1 = Spinbox(self, from_=0, to=1000, width=5, textvariable=self.EVENT) sb1.grid(row=3,column=3, sticky=W) sb1_label = Label(self, text="EVENT") sb1_label.grid(row=2,column=3, padx=0, sticky=W) self.LIMIT_L.set("19000") sb1 = Spinbox(self, from_=0, to=100000, width=5, textvariable=self.LIMIT_L) sb1.grid(row=5,column=2, sticky=W) sb1_label = Label(self, text="ROI Start ") sb1_label.grid(row=4,column=2, padx=0, sticky=W) self.LIMIT_H.set("22500") sb1 = Spinbox(self, from_=0, to=100000, width=5, textvariable=self.LIMIT_H) sb1.grid(row=5,column=3, sticky=W) sb1_label = Label(self, text="ROI End ") sb1_label.grid(row=4,column=3, padx=0, sticky=W) self.PULSE_R.set("20142") sb1 = Spinbox(self, from_=0, to=100000, width=8, textvariable=self.PULSE_R) sb1.grid(row=5,column=4, sticky=E) sb1_label = Label(self, text=" Pulse Rise") sb1_label.grid(row=4,column=4, padx=0, sticky=E) self.PULSE_L.set("1200") sb1 = Spinbox(self, from_=0, to=5000, width=8, textvariable=self.PULSE_L) sb1.grid(row=5,column=5, sticky=E) sb1_label = Label(self, text=" Pulse Length") sb1_label.grid(row=4,column=5, padx=0, sticky=E) sb1_label = Label(self, text=" ") sb1_label.grid(row=2,column=7, padx=0, sticky=W) sb1_label = Label(self, text=" ") sb1_label.grid(row=6,column=7, padx=0, sticky=W) self.pulse_height.set("545.5") sb1 = Entry(self, width=8, textvariable=self.pulse_height) sb1.grid(row=7,column=3, sticky=E) sb1_label = Label(self, text=" Amplitude") sb1_label.grid(row=6,column=3, padx=0, sticky=E) self.amplitude_range.set("2") sb1 = Entry(self, width=8, textvariable=self.amplitude_range) sb1.grid(row=7,column=4, sticky=E) sb1_label = Label(self, text=" Loop Range") sb1_label.grid(row=6,column=4, padx=0, sticky=E) self.delta.set("0.1") sb1 = Entry(self, width=8, textvariable=self.delta) sb1.grid(row=7,column=5, sticky=E) sb1_label = Label(self, text=" Loop Delta") sb1_label.grid(row=6,column=5, padx=0, sticky=E) self.noise_sigma.set("4") sb1 = Entry(self, width=3, textvariable=self.noise_sigma) sb1.grid(row=5,column=6, sticky=E) sb1_label = Label(self, text=" Noise Threshold") sb1_label.grid(row=4,column=6, padx=0, sticky=E) sb_coeff_label = Label(self, text= "Coefficient ") sb_coeff_label.grid(row=0,column=6, padx=0, sticky=E) self.sb_coeff = Label(self) self.sb_coeff.grid(row=1,column=6, padx=0, sticky=E) # MAIN BUTTONS obtn = Button(self, text="GO!!", command=self.find_C) obtn.grid(row=14, column=4, sticky=E, pady=10) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=14, column=5, sticky=E, pady=10) hbtn = Button(self, text="Help", command=self.help_f) hbtn.grid(row=14, column=0, sticky=W, pady=10)
def initUI(self): self.parent.title("FIND SPE VALUE") self.pack(fill=BOTH, expand=True) self.columnconfigure(0, weight=1) #self.rowconfigure(0, weight=1) # weight attibute is used to make them growable self.graph_cb = BooleanVar() self.bins = IntVar() self.path = StringVar() self.n_files = IntVar() self.start_s = IntVar() self.end_s = IntVar() self.guess = IntVar() search = Image.open("next_logo.jpg") search_temp = search.resize((160, 200), Image.ANTIALIAS) search_aux = ImageTk.PhotoImage(search_temp) label1 = Label(self, image=search_aux) label1.image = search_aux label1.grid(row=0, column=0, columnspan=10, rowspan=10, sticky=E + W + S + N) #Number of Files and Bins. Spin Box self.n_files.set("2000") sb1 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.n_files) sb1.grid(row=1, column=4, sticky=W) sb1_label = Label(self, text="Files") sb1_label.grid(row=1, column=3, padx=5, sticky=E) self.bins.set("50") sb2 = Spinbox(self, from_=10, to=200, width=6, textvariable=self.bins) sb2.grid(row=1, column=6, sticky=W) sb2_label = Label(self, text="Hist. Bins") sb2_label.grid(row=1, column=5, padx=5, sticky=E) # INTEGRATION LIMITS Integration_label = Label(self, text="INTEGRATION", font="Verdana 12 bold") Integration_label.grid(row=3, column=4, padx=5, columnspan=2) self.start_s.set("1732") sb3 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.start_s) sb3.grid(row=4, column=4, sticky=W) sb3_label = Label(self, text="StartPoint") sb3_label.grid(row=4, column=3, padx=5, sticky=E) self.end_s.set("1752") sb4 = Spinbox(self, from_=1, to=10000, width=6, textvariable=self.end_s) sb4.grid(row=4, column=6, sticky=W) sb4_label = Label(self, text="EndPoint") sb4_label.grid(row=4, column=5, padx=5, sticky=E) sb4_label = Label(self, text="") sb4_label.grid(row=4, column=7, padx=5, sticky=E) # FITTING PARAMETERS Integration_label = Label(self, text="FITTING", font="Verdana 12 bold") Integration_label.grid(row=6, column=4, padx=5, columnspan=2) self.guess.set("-20") sb5 = Spinbox(self, from_=-50, to=-1, width=6, textvariable=self.guess) sb5.grid(row=7, column=4, sticky=W) sb5_label = Label(self, text="SPE guess") sb5_label.grid(row=7, column=5, padx=5, sticky=W) #Check buttons cb1 = Checkbutton(self, text="MultiGraph Output", variable=self.graph_cb) cb1.select() cb1.grid(row=7, column=6, sticky=W) #Text Box #self.path.set("F:/DATOS_DAC/spe_1230/2046/pmt_0_trace_evt_") self.path.set("spe_1230_2046.h5.z") e1 = Entry(self, textvariable=self.path, width=45) e1.grid(row=10, column=3, sticky=W, columnspan=10, padx=10, pady=5) e1_label = Label(self, text="DataSet path (including name file)") e1_label.grid(row=9, column=3, sticky=W, columnspan=10, padx=10) # Main buttons obtn = Button(self, text="GO!!", command=self.SPE_f) obtn.grid(row=14, column=5, sticky=E, pady=5) cbtn = Button(self, text="Quit", command=self.quit) cbtn.grid(row=14, column=6, sticky=E, pady=5) hbtn = Button(self, text="Help") hbtn.grid(row=14, column=0, sticky=W, pady=5)