def create_buttons(self): for properties in GUI_CONF_DICT.itervalues(): if button_label in properties: print "Found a button: {}".format(properties[button_label]) print "Creating a button for: {}".format(properties[histpath_label]) temp_button = ROOT.TGTextButton(self.buttons_frame, "&{}".format(properties[button_label])) temp_button.Connect('Clicked()', "TPyDispatcher", self.dispatcher, 'Dispatch()') self.buttons_frame.AddFrame(temp_button, ROOT.TGLayoutHints())
def create_buttons(self): for properties in GUI_CONF_DICT.itervalues(): if button_label in properties: print "Found a button: {}".format(properties[button_label]) print "Creating a button for: {}".format( properties[histpath_label]) temp_button = ROOT.TGTextButton( self.buttons_frame, "&{}".format(properties[button_label])) temp_button.Connect('Clicked()', "TPyDispatcher", self.dispatcher, 'Dispatch()') self.buttons_frame.AddFrame(temp_button, ROOT.TGLayoutHints())
def clever_dispatching(self): btn = ROOT.BindObject(ROOT.gTQSender, ROOT.TGTextButton) label = btn.GetText() print "Looking for a histogram for button: {}".format(label) for properties in GUI_CONF_DICT.itervalues(): try: if properties[button_label].strip() == str(label).strip(): hist = self.data_file.Get(properties[histpath_label]) self.canvas.cd(properties[canvas_part]) print "Histogram has been succesfully found, drawing..." hist.Draw() ROOT.gPad.Update() return except KeyError: continue else: print "ERROR: The button couldn't have been found"