Ejemplo n.º 1
0
    def __init__(self, root, data_win, stream_q):
        self.root = root

        #self.width=sub_width
        #self.height=sub_height

        self.data_win = data_win
        self.data_win.diagnostics()
        self.runtime = 0

        self.fs = 0
        self.qual = ""
        self.bpm = 0
        self.rhythm = ""
        self.arr_raw = []
        self.arr_filt = []

        self.rec = tk.BooleanVar()
        self.timer = IntVar()
        self.rec_vals = []
        self.send_vals = []

        self.q = stream_q

        self.filt = False
        self.stream = False
        self.proc = False
        self.f_shift = 0

        self.proc_done = tk.BooleanVar()
Ejemplo n.º 2
0
    def __init__(self, title='AirtestX Basic GUI', device=None):
        self._device = device
        self._root = tk.Tk()
        self._root.title(title)
        self._queue = Queue()

        self._refresh_text = tk.StringVar()
        self._refresh_text.set("Refresh")
        self._gencode_text = tk.StringVar()
        self._auto_refresh_var = tk.BooleanVar()
        self._uiauto_detect_var = tk.BooleanVar()
        self._attachfile_text = tk.StringVar()
        self._running = False  # if background is running

        self._init_items()
        self._init_thread()
        self._init_refresh()

        self._lastx = 0
        self._lasty = 0
        self._bounds = None  # crop area
        self._center = (0, 0)  # center point
        self._offset = (0, 0)  # offset to image center
        self._size = (90, 90)
        self._moved = False  # click or click and move
        self._color = 'red'  # draw color
        self._tkimage = None  # keep reference
        self._image = None
        self._ratio = 0.5
        self._uinodes = []  # ui dump
        self._selected_node = None
        self._hovered_node = None

        self._init_vars()
Ejemplo n.º 3
0
    def __init__(self, master, width, height, arrow_width, border):
        self.arrow_width = arrow_width
        self.font_size = 10

        self.height = height * 11 / 17
        self.width = width * 7 / 18
        self.master = master

        self.proc_canvas = Tk.Canvas(master,
                                     bg="white",
                                     width=self.width,
                                     height=self.height,
                                     bd=border,
                                     highlightthickness=border)
        self.proc_canvas.grid(row=5, column=6, rowspan=11, columnspan=7)

        self.entry_width = None
        self.exit_height = None
        self.switches = [None] * 7
        self.switch_states = [0] * 7
        self.target_states = [0] * 7
        self.switch_text = [None] * 7
        self.switch_length = 8 * arrow_width
        self.animation_done = True

        self.lines = [[] for i in range(32)]
        self.draw_processor(arrow_width)
        self.switch_done = Tk.BooleanVar()
        self.flow_done = Tk.BooleanVar()
        self.current_line = 0
        self.iterator = iter(self.lines[self.current_line])
        self.cable_color = 'red'
Ejemplo n.º 4
0
    def __init__(self, root, **kwargs):
        tk.LabelFrame.__init__(self, root, text="Loaded Objects", **kwargs)
        self.root = root

        self.calculation = None
        self.activeselection = None

        # needUpdate signals when the list of objects needs to be refreshed
        self.needUpdate = tk.BooleanVar()
        self.needUpdate.trace('r', self.update)

        # selectionchanged can be used by the root window to determine when
        # the DetailViewer needs to be loaded with a new object
        self.selectionchanged = tk.BooleanVar()
        self.selectionchanged.set(True)

        self.content = tk.Text(self,
                               cursor="arrow",
                               state="disabled",
                               width=30,
                               height=20)
        self.scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)

        # bind scrollbar actions
        self.scrollbar.config(command=self.content.yview)
        self.content['yscrollcommand'] = self.scrollbar.set

        # arrange and display list elements
        self.content.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
        self.content.update()
        self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
Ejemplo n.º 5
0
    def onAddCmdToViewer(self):
        #if not self.vf.commands.has_key('vision'):
        #    self.vf.browseCommands('visionCommands',log=False)
        #if self.vf.vision.ed is None:
        #    self.vf.vision(log=False)
        self.vf.browseCommands('displayCommands', commands=('DisplayBoundGeom',), log=0, package='Pmv')

        if self.vf.hasGui:
            self.bindFlag = Tkinter.BooleanVar()
            self.bindFlag.set(self.bindGeom)

            self.perMolFlag = Tkinter.BooleanVar()
            self.perMolFlag.set(self.perMol)
        
            self.checkComponentsFlag = Tkinter.BooleanVar()
            self.checkComponentsFlag.set(False)
        
            self.messageDialog = Pmw.MessageDialog(self.vf.master, buttons=(), iconpos = 'w',
                                               icon_bitmap = 'warning')
            self.messageDialog.withdraw()
            self.messageDialog.configure(message_text="Please wait.\n It will take time to compute.")
            self.autoPlaceWidget = AutoPlaceWidget()
            self.autoPlaceWidget.root = self.messageDialog.winfo_toplevel()
        else:
            from mglutil.util.misc import BooleanVar
            self.bindFlag = BooleanVar(self.bindGeom)
            self.checkComponentsFlag = BooleanVar(False)
            self.perMolFlag = BooleanVar(self.perMol)

        from DejaVu.VisionInterface.GeometryNodes import ConnectedComponents
        self.connectedComp = ConnectedComponents()
Ejemplo n.º 6
0
    def __init__(self, parent, *args, **kwargs):
        Tkinter.Frame.__init__(self, parent, *args, **kwargs)
        self.title = Tkinter.Label(master=self, text="muse231")
        self.title.pack(side=Tkinter.TOP)

        #self.img=Tkinter.PhotoImage(file="pictures/muse231.gif")
        #Tkinter.Label(master=self, image=self.img).pack(side=Tkinter.LEFT)

        self.valframe = Tkinter.Frame(master=self,
                                      relief=Tkinter.RAISED,
                                      borderwidth=1)
        self.valframe.pack(side=Tkinter.TOP)
        Tkinter.Label(master=self.valframe,
                      text="Measurement Data").pack(side=Tkinter.TOP)

        self.sht_t = Tkinter.DoubleVar(value=25.0)
        ValField(master=self.valframe,
                 name="SHT T",
                 unit="degC",
                 val=self.sht_t).pack(side=Tkinter.BOTTOM)

        self.sht_rh = Tkinter.DoubleVar(value=0.5)
        ValField(master=self.valframe,
                 name="SHT RH",
                 unit="vH",
                 val=self.sht_rh).pack(side=Tkinter.BOTTOM)

        self.vmcu = Tkinter.DoubleVar(value=2.85)
        ValField(master=self.valframe, name="VMCU", unit="mV",
                 val=self.vmcu).pack(side=Tkinter.BOTTOM)

        self.cfgframe = Tkinter.Frame(master=self,
                                      relief=Tkinter.RAISED,
                                      borderwidth=1)
        self.cfgframe.pack(side=Tkinter.TOP)
        Tkinter.Label(master=self.cfgframe,
                      text="Configuration").pack(side=Tkinter.TOP)

        self.cfg_accenable = Tkinter.BooleanVar()
        Tkinter.Checkbutton(master=self.cfgframe,
                            text="ACC enable",
                            variable=self.cfg_accenable).pack(side=Tkinter.TOP)
        self.cfg_shtenable = Tkinter.BooleanVar()
        Tkinter.Checkbutton(master=self.cfgframe,
                            text="SHT21 enable",
                            variable=self.cfg_shtenable).pack(side=Tkinter.TOP)
        self.cfg_blink = Tkinter.BooleanVar()
        Tkinter.Checkbutton(master=self.cfgframe,
                            text="Blink on sample",
                            variable=self.cfg_blink).pack(side=Tkinter.TOP)

        rates = [0.1, 1.0, 8.0, 60.0]
        self.cfg_samplerate = Tkinter.DoubleVar()
        Tkinter.Label(master=self.cfgframe,
                      text='Sample Rate [Hz]').pack(side=Tkinter.TOP)
        cb = Tix.ComboBox(master=self.cfgframe, variable=self.cfg_samplerate)
        cb.pack(side=Tkinter.TOP)
        bal = Tix.Balloon(self.cfgframe)
        bal.bind_widget(cb, balloonmsg="Sample rate of measurement")
        [cb.insert(Tix.END, '%.2f' % (1 / i)) for i in rates]
Ejemplo n.º 7
0
 def __init__(self,
              PlotItem,
              callback,
              parent=None,
              side='top',
              anchor='w'):
     Tk.Frame.__init__(self, parent)
     label = Tk.Label(self, text='Entries')
     label.pack(side='top', anchor='center')
     self.values = []
     for index, pick in enumerate(PlotItem.columns, start=0):
         value = Tk.BooleanVar()
         value.set(1)  # defult value as checked
         check = Tk.Checkbutton(self,
                                text=pick,
                                width=18,
                                bg=__colors__[index],
                                variable=value,
                                anchor='w',
                                justify='left',
                                command=callback)
         check.pack(side=side, anchor=anchor, expand='no')
         self.values.append(value)
     value_normalized = Tk.BooleanVar()
     check_normalized = Tk.Checkbutton(self,
                                       text='Scaled [0,1]',
                                       variable=value_normalized,
                                       justify='left',
                                       command=callback)
     check_normalized.pack(side=side, anchor=anchor, expand='no')
     self.values.append(value_normalized)
Ejemplo n.º 8
0
    def __init__(self):
        tk.Tk.__init__(self)
        self.title("Enrich 2 Configurator")

        self.treeview = None
        self.treeview_popup_target_id = None

        self.cfg_file_name = tk.StringVar()

        self.element_dict = dict()
        self.root_element = None

        # analysis options
        self.scoring_method = tk.StringVar()
        self.logr_method = tk.StringVar()
        self.force_recalculate = tk.BooleanVar()
        self.component_outliers = tk.BooleanVar()
        self.plots_requested = tk.BooleanVar()
        self.tsv_requested = tk.BooleanVar()

        # allow resizing
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        # create UI elements
        self.create_main_frame()
        self.create_menubar()
        self.create_treeview_context_menu()
Ejemplo n.º 9
0
 def __init__(self,
              master=None,
              callback=None,
              label=True,
              fontsize=11,
              **kwargs):
     """
     :param master: master widget
     :param callback: callback with argument (bool bold, bool italic, bool underline, bool overstrike)
     :param label: show a header label
     :param fontsize: size of the font on the buttons
     :param kwargs: keyword arguments passed on to Frame initializer
     """
     ttk.Frame.__init__(self, master, **kwargs)
     self._style = ttk.Style()
     self.__label = label
     self.__callback = callback
     self._header_label = ttk.Label(self, text="Font properties:")
     self._style.configure("Bold.Toolbutton",
                           font=("default", fontsize, "bold"),
                           anchor=tk.CENTER)
     self._style.configure("Italic.Toolbutton",
                           font=("default", fontsize, "italic"),
                           anchor=tk.CENTER)
     self._style.configure("Underline.Toolbutton",
                           font=("default", fontsize, "underline"),
                           anchor=tk.CENTER)
     self._style.configure("Overstrike.Toolbutton",
                           font=("default", fontsize, "overstrike"),
                           anchor=tk.CENTER)
     self._bold = tk.BooleanVar()
     self._italic = tk.BooleanVar()
     self._underline = tk.BooleanVar()
     self._overstrike = tk.BooleanVar()
     self._bold_button = ttk.Checkbutton(self,
                                         style="Bold.Toolbutton",
                                         text="B",
                                         width=2,
                                         command=self._on_click,
                                         variable=self._bold)
     self._italic_button = ttk.Checkbutton(self,
                                           style="Italic.Toolbutton",
                                           text="I",
                                           width=2,
                                           command=self._on_click,
                                           variable=self._italic)
     self._underline_button = ttk.Checkbutton(self,
                                              style="Underline.Toolbutton",
                                              text="U",
                                              width=2,
                                              command=self._on_click,
                                              variable=self._underline)
     self._overstrike_button = ttk.Checkbutton(
         self,
         style="Overstrike.Toolbutton",
         text="O",
         width=2,
         command=self._on_click,
         variable=self._overstrike)
     self._grid_widgets()
Ejemplo n.º 10
0
 def define_variables(self):
     self.solver_name = tk.StringVar(self.master)
     self.function = tk.StringVar(self.master)
     self.popsize = tk.IntVar(self.master)
     self.max_iter = tk.IntVar(self.master)
     self.interval = tk.IntVar(self.master)
     self.mcmc_stepsize_x1 = tk.DoubleVar(self.master)
     self.mcmc_stepsize_x2 = tk.DoubleVar(self.master)
     self.hmc_stepsize = tk.DoubleVar(self.master)
     self.log_mcmc_stepsize_x1 = tk.DoubleVar(self.master)
     self.log_mcmc_stepsize_x2 = tk.DoubleVar(self.master)
     self.log_hmc_stepsize = tk.DoubleVar(self.master)
     self.n_leap = tk.IntVar(self.master)
     self.w = tk.DoubleVar(self.master)
     self.c1 = tk.DoubleVar(self.master)
     self.c2 = tk.DoubleVar(self.master)
     self.gamma = tk.DoubleVar(self.master)
     self.CR = tk.DoubleVar(self.master)
     self.F = tk.DoubleVar(self.master)
     self.strategy = tk.StringVar(self.master)
     self.sigma = tk.DoubleVar(self.master)
     self.mu_perc = tk.DoubleVar(self.master)
     self.seed = tk.IntVar(self.master)
     self.fix_seed = tk.BooleanVar(self.master)
     self.constrain = tk.BooleanVar(self.master)
     self.sync = tk.BooleanVar(self.master)
Ejemplo n.º 11
0
	def __init__(self,master,width=1024,height=768,reworked=False):
		tk.Canvas.__init__(self,master,width=width,height=height)
		self.width = width
		self.height = height
		self.grid(rowspan=2,column=0)
		self.grid_propagate(0)
		self.v_speed = 500
		self.offsets = [0,0]
		self.y_offset = tk.StringVar()
		self.image = self.create_text((self.width/2,self.height/2),text='Choose a slide folder')
		self.border_check = tk.IntVar()
		self.speed_dict = dict()
		self.show_connection = tk.IntVar()
		self.rescaled = tk.BooleanVar(value=False)
		self.themeID = tk.StringVar()
		self.fixation_frame = None
		self.first_init = True
		self.edit_mode = tk.BooleanVar(value=False)
		self.reworked = reworked

		# dummies for the first initialization
		self.fixpointR_dict = dict()
		self.connect_dict = dict()
		self.border_visual = list()

		# speed steps
		s1 = [x for x in range(5,105,5)]
		s2 = [x*10 for x in s1]
		for i in range(20):
			self.speed_dict[s1[i]] = s2[(-1)-i]

		self.cleanArticle()
Ejemplo n.º 12
0
    def __init__(self, master, **options):
        tk.Frame.__init__(self, master, **options)
        self.master = master

        self.number_item_viewers = 0
        self.MAX_ITEM_VIEWERS = 10
        self.item_viewers = []
        self.fTop = tk.Frame(self)

        self.text = tk.Text(self.fTop)

        self.text.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

        self.scroll = tk.Scrollbar(self.fTop)
        self.scroll.pack(side=tk.RIGHT, fill=tk.Y)

        self.text.config(font="Courier 12", yscrollcommand=self.scroll.set)
        self.scroll.config(command=self.text.yview)

        self.fTop.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

        self.fBottom = tk.Frame(self)

        self.return_button = tk.Button(self.fBottom, text='Execute Plan')
        self.return_button.config(command=self.return_results)
        self.return_button.pack(side=tk.RIGHT)

        self.continue_button = tk.Button(self.fBottom, text='Skip Rest')
        self.continue_button.config(command=self.user_continue)
        self.continue_button.pack(side=tk.RIGHT)

        self.next_button = tk.Button(self.fBottom, text='Next Step')
        self.next_button.config(command=self.user_unpause)
        self.next_button.pack(side=tk.RIGHT)

        self.fBottom.pack(side=tk.TOP)

        self.fPlan = tk.Frame(self)
        self.fPlan.pack(side=tk.BOTTOM)

        self.paused = tk.BooleanVar()
        self.paused.set(False)

        self.continued = tk.BooleanVar()
        self.continued.set(False)

        self.bind('<<display-text>>', self.display_text_handler)
        self.bind('<<user-pause>>', self.user_pause_handler)

        self.message = Queue.Queue()
        self.callback = Queue.Queue(
        )  # wait on items in this queue to continue

        self.pack(fill=tk.BOTH, expand=True)

        def window_close_handler():
            self.return_results()

        self.master.protocol("WM_DELETE_WINDOW", window_close_handler)
Ejemplo n.º 13
0
    def get_populate(self, frame, VAR):
        """Function: Get Populate
        Sets up a frame to hold optional populate field check buttons."""
        populate_frame = TK.Frame(frame, relief=TK.RIDGE, bd=1)
        populate_frame.grid(row=1, column=1, padx=3, pady=3, sticky=TK.W)

        label_populate = TK.Label(populate_frame, text='Populate Attributes')
        label_populate.grid(row=0, padx=9, pady=(3, 0))

        glims_boolean = TK.BooleanVar()
        check_glims = TK.Checkbutton(populate_frame,
                                     text="GLIMS ID's",
                                     variable=glims_boolean,
                                     onvalue=True,
                                     offvalue=False)
        check_glims.grid(row=1, padx=10, sticky=TK.W)
        glims_boolean.set(VAR.read_variable("GLIMSIDS"))

        def __callback_RGI():
            self.enable()

        rgi_boolean = TK.BooleanVar()
        check_rgi = TK.Checkbutton(populate_frame,
                                   text="RGI ID's",
                                   variable=rgi_boolean,
                                   onvalue=True,
                                   offvalue=False,
                                   command=__callback_RGI)
        check_rgi.grid(row=2, padx=10, pady=(3, 0), sticky=TK.W)
        rgi_boolean.set(VAR.read_variable("RGIIDS"))

        rgi_frame = TK.Frame(populate_frame)
        rgi_frame.grid(row=3, pady=(0, 9), sticky=TK.W)

        label_version = TK.Label(rgi_frame, text='Ver.')
        label_version.grid(row=0, column=0, padx=(10, 0), sticky=TK.W)

        ver_string = TK.StringVar()
        ver_entry = TK.Entry(rgi_frame,
                             textvariable=ver_string,
                             width=3,
                             justify=TK.CENTER)
        ver_entry.grid(row=0, column=1, padx=(0, 5), sticky=TK.W)
        ver_string.set(VAR.read_variable("RGIVERSION"))

        label_region = TK.Label(rgi_frame, text='Reg.')
        label_region.grid(row=0, column=2, padx=(5, 0), sticky=TK.W)

        reg_string = TK.StringVar()
        reg_entry = TK.Entry(rgi_frame,
                             textvariable=reg_string,
                             width=3,
                             justify=TK.CENTER)
        reg_entry.grid(row=0, column=3, padx=(0, 0), sticky=TK.W)
        reg_string.set(VAR.read_variable("RGIREGION"))

        return glims_boolean, rgi_boolean, ver_string, reg_string, ver_entry, reg_entry
Ejemplo n.º 14
0
    def addConsole(self):
        """ view - console output
		"""
        self.gridrow = 0

        self.widgets['infoFrame'] = Tkinter.Frame(self.widget,
                                                  bg=self.colours['bg'],
                                                  borderwidth=0,
                                                  highlightthickness=0)
        self.widgets['infoFrame'].grid(column=0, row=0, sticky='WE')

        self.widgets['frameLabel'] = Tkinter.Label(
            self.widgets['infoFrame'],
            text='Console',
            anchor=NW,
            borderwidth=1,
            bg=self.colours['bg'],
            fg=self.colours['headingfg'])
        self.widgets['frameLabel'].grid(column=0, row=0, sticky='WE')

        self.variables['enabled'] = Tkinter.BooleanVar()
        self.variables['enabled'].set(Setting.get('console_enabled', False))
        self.widgets['enabledentry'] = Tkinter.Checkbutton(
            self.widgets['infoFrame'],
            text="Enabled",
            variable=self.variables['enabled'],
            command=self.OnToggleConsoleClick,
            bg=self.colours['inputbg'],
            fg=self.colours['inputfg'],
            activebackground=self.colours['activebg'],
            selectcolor=self.colours['inputbg'])
        self.widgets['enabledentry'].grid(column=1, row=0, sticky='E')

        self.variables['terminal'] = Tkinter.BooleanVar()
        self.variables['terminal'].set(Setting.get('console_use_old', True))
        self.widgets['terminalentry'] = Tkinter.Checkbutton(
            self.widgets['infoFrame'],
            text="Copy to Terminal",
            variable=self.variables['terminal'],
            command=self.OnToggleTerminalClick,
            bg=self.colours['inputbg'],
            fg=self.colours['inputfg'],
            activebackground=self.colours['activebg'],
            selectcolor=self.colours['inputbg'])
        self.widgets['terminalentry'].grid(column=2, row=0, sticky='E')

        self.widgets['infoData'] = Tkinter.Label(
            self.widgets['infoFrame'],
            textvariable=self.logger.output,
            anchor=W,
            justify="left",
            bg=self.colours['bg'],
            fg=self.colours['consolefg'])
        self.widgets['infoData'].grid(column=0,
                                      row=1,
                                      columnspan=3,
                                      sticky='WE')
 def init_gui(self, master):
     self.master = master
     master.title("Get subject files")
     # open up mirror directory popup
     self.mirror_button = tk.Button(master, text="Create mirror", command = lambda: self.popup_mirror())
     self.mirror_button.pack(anchor='n')
     # choose between recursing directory or scanning csv
     self.recurse_or_scan = tk.BooleanVar()
     self.recurse_or_scan_button = tk.Checkbutton(master, text='Check box to scan from csv.\n Leave empty to recurse directory.', variable=self.recurse_or_scan)
     self.recurse_or_scan_button.pack(anchor='w')
     # close button
     self.close_button = tk.Button(master, text="close", command = master.quit)
     self.close_button.pack(side=tk.BOTTOM)
     # label for crawl directory
     self.crawl_dir = os.getcwd()
     crawlDirLabel = tk.Label(master, text="Crawl directory:")
     crawlDirLabel.pack(anchor="w")
     self.current_crawl_dir = tk.Label(master, bg="white", text = self.crawl_dir)
     self.current_crawl_dir.pack(anchor="w", padx=5)
     #browser to choose crawl directory
     self.choose_crawl_directory_button = tk.Button(master, text="Browse", command=lambda: self.choose_directory("crawl"))
     self.choose_crawl_directory_button.pack(anchor="center", pady=(0,10))
     self.crawl_dir_opt = options = {}
     options["initialdir"] = os.getcwd()
     options["mustexist"] = True
     # label for output directory
     self.output_dir = os.getcwd()
     outputDirLabel = tk.Label(master, text="Output directory:")
     outputDirLabel.pack(anchor="w")
     self.current_output_dir = tk.Label(master, bg="white", text=self.output_dir)
     self.current_output_dir.pack(anchor="w", padx=5)
     # browser to choose output directory
     self.choose_output_directory_button = tk.Button(master, text="Browse", command=lambda: self.choose_directory("output"))
     self.choose_output_directory_button.pack(anchor='center', pady=(0,10))
     self.output_dir_opt = options
     # choose to save as csv or copy files to directory
     self.copy_or_csv = tk.StringVar()
     self.saveLabel = tk.Label(master, text="What do you want to do with these files?")
     self.saveLabel.pack(anchor='w')
     self.filename = tk.Entry(master)
     self.copy_files_radio = tk.Radiobutton(master, text="copy files to output directory", variable=self.copy_or_csv, value="copy", command=self.disableEntry)
     self.copy_files_radio.pack(anchor="w", padx=(20, 0))
     self.dump_or_keep = tk.BooleanVar()
     self.dump_or_keep_button = tk.Checkbutton(master, text='Check to dump files to output directory.\nLeave unchecked to keep directory structure.', variable=self.dump_or_keep)
     self.dump_or_keep_button.pack(anchor='w', padx=(40, 0))
     self.save_as_CSV_radio = tk.Radiobutton(master, text="save as CSV of all filepaths in output directory.\n File name:", variable=self.copy_or_csv,value="csv", command=self.enableEntry, justify="left")
     self.save_as_CSV_radio.pack(anchor="w", padx=(20,0))
     self.filename.pack(anchor="w", padx=(48, 0), pady=(0,10))
     self.copy_files_radio.invoke()
     # subject ranges
     self.choose_files_button = tk.Button(master, text="Choose file types", command = lambda:self.file_type_chooser())
     self.choose_files_button.pack(anchor='center')
     # start process
     # self.start_button = tk.Button(master, text="start", command = lambda: self.crawl_files(self.crawl_dir))
     self.start_button = tk.Button(master, text="start", command = lambda: self.multi_call())
     #self.start_button.config(state="disable")
     self.start_button.pack(side=tk.BOTTOM, pady=(10,0))
Ejemplo n.º 16
0
    def _create_words_frame(self):
        frame = tk.Frame(self.root)

        toolbar = tk.Frame(frame)

        self.show_word = tk.BooleanVar()
        self.show_def = tk.BooleanVar()
        self.show_word.set(True)
        self.show_def.set(True)
        checkboxes = tk.Frame(toolbar)
        show_word_box = tk.Checkbutton(checkboxes,
                                       text="show word",
                                       variable=self.show_word,
                                       onvalue=True,
                                       offvalue=False,
                                       command=self._draw_word)
        show_word_box.grid(row=0, column=0, sticky=tk.W)
        show_def_box = tk.Checkbutton(checkboxes,
                                      text="show definition",
                                      variable=self.show_def,
                                      onvalue=True,
                                      offvalue=False,
                                      command=self._draw_word)
        show_def_box.grid(row=1, column=0, sticky=tk.W)
        checkboxes.pack(side="left")

        buttons = tk.Frame(toolbar)
        previous_but = tk.Button(buttons,
                                 text="Previous",
                                 width=8,
                                 command=self._previous_cb)
        previous_but.pack(side="left", fill="y")
        next_but = tk.Button(buttons,
                             text="Next",
                             width=8,
                             command=self._next_cb)
        next_but.pack(side="right", fill="y")
        buttons.pack(side="right", fill="y")
        toolbar.pack(side="top", expand=1, fill="x")

        wordtext = uicomponents.ScrolledText(frame)
        wordtext.text.config(height=10)
        wordtext.text.config(font=fonts.dict_font)
        wordtext.pack(fill="both")

        wordlist = uicomponents.ScrolledList(frame)
        wordlist.listbox.config(height=20)
        wordlist.pack(fill="both", expand=1)

        frame.pack(fill="y", side="right", expand=1)

        self.wordlist = wordlist.listbox
        self.wordtext = wordtext.text

        self.wordlist.bind("<ButtonRelease-1>", self._select_word_cb)
        self.wordlist.bind("<KeyRelease-Up>", self._select_word_cb)
        self.wordlist.bind("<KeyRelease-Down>", self._select_word_cb)
Ejemplo n.º 17
0
  def __init__(self, session):

    tkutil.Settings_Dialog.__init__(self, session.tk, 'Peak List Settings')

    fb = tk.Frame(self.top, borderwidth=3, relief='groove')
    fb.pack(side='top', fill='x')

    #
    # Create the checkbutton and Manual Coefficients section
    #
    self.field_widgets = {}
    for fc in field_classes:
      self.field_widgets[fc] = fc.field_widgets(self.top, fc.name)


    opt = tk.Frame(self.top, borderwidth=3, relief='groove')
    opt.pack(side='top', fill='x')

    global manual_coeff, coeff1, coeff2, coeff3, SNR_abs, volume_abs

    manual_coeff = tk.BooleanVar()
    manual_coeff.set(False)
    checkbox_coeff = tk.Checkbutton(opt, highlightthickness=0, text='Manual Coefficients',
                                    variable=manual_coeff, command=self.show_coeff_settings)
    checkbox_coeff.pack(side='top', anchor='w')
    tkutil.create_hint(checkbox_coeff, 'Manually specify the coefficients for the Reliability Score formula')


    coeff1 = tkutil.entry_field(opt, 'Volume Coeff.: ', width=5, initial='1e7')
    tkutil.create_hint(coeff1.frame, 'Specify the coefficient for the Volume in the Reliability Score formula')

    coeff2 = tkutil.entry_field(opt, 'SNR Coeff.: ', width=5, initial='10')
    tkutil.create_hint(coeff2.frame, 'Specify the coefficient for the Signal to Noise Ratio (SNR) in the Reliability Score formula')


    coeff3 = tkutil.entry_field(opt, 'Linewidth Coeff.: ', width=5, initial='0.1')
    tkutil.create_hint(coeff3.frame, 'Specify the coefficient for the Linewidth in the Reliability Score formula')

    SNR_abs = tk.BooleanVar()
    SNR_abs.set(True)
    self.checkbox_SNR_abs = tk.Checkbutton(opt, highlightthickness=0, text='Absolute SNR',
                                           variable=SNR_abs)
    tkutil.create_hint(self.checkbox_SNR_abs, 'If checked, the Reliability Score will only have absolute values for SNR')

    volume_abs = tk.BooleanVar()
    volume_abs.set(False)
    self.checkbox_volume_abs = tk.Checkbutton(opt, highlightthickness=0, text='Absolute Volume',
                                              variable=volume_abs)
    tkutil.create_hint(self.checkbox_volume_abs, 'If checked, the Reliability Score will only have absolute values for Volume')


    br = tkutil.button_row(self.top,
                      ('Ok', self.ok_cb),
                      ('Apply', self.apply_cb),
                      ('Close', self.close_cb),
                      )
    br.frame.pack(side='top', anchor='w')
Ejemplo n.º 18
0
 def test_entryconfigure_variable(self):
     m1 = self.create()
     v1 = tkinter.BooleanVar(self.root)
     v2 = tkinter.BooleanVar(self.root)
     m1.add_checkbutton(variable=v1, onvalue=True, offvalue=False,
                        label='Nonsense')
     self.assertEqual(str(m1.entrycget(1, 'variable')), str(v1))
     m1.entryconfigure(1, variable=v2)
     self.assertEqual(str(m1.entrycget(1, 'variable')), str(v2))
Ejemplo n.º 19
0
    def __init__(self,
                 root=None,
                 selected=None,
                 confirmed=None,
                 messageBar=None):
        """
        Constructor
        root: the parent container widget (e.g. Toplevel, Frame, etc.)
        selected: a Tkinter.BooleanVar control variable
        confirmed: a Tkinter.BooleanVar control variable
        messageBar: a Pmw.MessageBar object
        """
        if root:
            self.root = root
        else:
            self.root = Tix.Tk()

        self.messageBar = messageBar

        self.selected = selected
        if self.selected == None:
            self.selected = Tkinter.BooleanVar()
            self.selected.set(False)

        self.confirmed = confirmed
        if self.confirmed == None:
            self.confirmed = Tkinter.BooleanVar()
            self.confirmed.set(False)

        self.frame = Tkinter.Frame(self.root)

        self.db_Tree = Tix.Tree(self.frame,
                                browsecmd=self.SelectRow,
                                command=self.ConfirmRow)
        self.db_Tree.hlist.configure(separator="/", selectmode="single")
        self.db_Tree.grid(row=0,
                          rowspan=40,
                          column=0,
                          columnspan=10,
                          sticky='nsew')

        self.confirmButton = Tkinter.Button(self.frame,
                                            text="Add Figure Directory",
                                            command=self.ConfirmRow)
        self.confirmButton.grid(row=40,
                                rowspan=1,
                                column=5,
                                columnspan=1,
                                sticky='nsew')

        self.LoadDatabase()
        #self.db_Tree.autosetmode()

        self.root.update()
Ejemplo n.º 20
0
 def file_type_chooser(self):
     window = tk.Toplevel(root)
     window.title("File type chooser")
     #window.overrideredirect(1)
     close = tk.Button(window, text="close", command=window.destroy)
     close.pack(side=tk.BOTTOM, pady=(10,0))
     # options for audio annotations
     self.file_options_label = tk.Label(window, text="What kinds of files do you want?")
     self.file_options_label.pack(anchor='w')
     self.audio_clan = tk.BooleanVar()
     self.clan_file_option = tk.Checkbutton(window, variable = self.audio_clan, text="Audio clan files")
     self.clan_file_option.pack(anchor='w')
     self.audio_basic = tk.BooleanVar()
     self.audio_basic_option = tk.Checkbutton(window, variable = self.audio_basic, text="Basic audio files")
     self.audio_basic_option.pack(anchor='w')
     self.video_datavyu = tk.BooleanVar()
     self.datavyu_file_option = tk.Checkbutton(window, variable = self.video_datavyu,text="Video datavyu files")
     self.datavyu_file_option.pack(anchor='w')
     self.video_basic = tk.BooleanVar()
     self.video_basic_option = tk.Checkbutton(window, variable = self.video_basic, text="Basic video files")
     self.video_basic_option.pack(anchor='w')
     self.silences=tk.BooleanVar()
     self.silences_option = tk.Checkbutton(window, variable=self.silences, text="Silence.txt files")
     self.silences_option.pack(anchor='w')
     self.lena5min = tk.BooleanVar()
     self.lena5min_option = tk.Checkbutton(window, variable=self.lena5min, text="lena5min files")
     self.lena5min_option.pack(anchor='w')
     self.video_mp4 = tk.BooleanVar()
     self.video_mp4_option = tk.Checkbutton(window, variable=self.video_mp4, text="Video mp4 files")
     self.video_mp4_option.pack(anchor='w')
     self.audio_wav = tk.BooleanVar()
     self.audio_wav_option = tk.Checkbutton(window, variable=self.audio_wav, text="Audio wav files")
     self.audio_wav_option.pack(anchor='w')
     self.custom_regex = tk.BooleanVar()
     self.custom_regex_option = tk.Checkbutton(window, variable=self.custom_regex, text="Write your own regex")
     self.custom_regex_option.pack(anchor='w')
     self.custom_regex_text = tk.Entry(window)
     self.custom_regex_text.pack(anchor="w", padx=(20, 0), pady=(0,10))
     # month ranges
     startMonthLabel = tk.Label(window, text="Start Month:")
     startMonthLabel.pack(anchor="w")
     self.start_month_var = tk.StringVar()
     self.start_month = tk.Spinbox(window, from_=6, to=18, textvariable=self.start_month_var, command=self.updateSpinbox)
     self.start_month_var.set(6)
     self.start_month.pack(anchor='w')
     endMonthLabel = tk.Label(window, text="End Month:")
     endMonthLabel.pack(anchor="w")
     self.end_month_var = tk.StringVar()
     self.end_month = tk.Spinbox(window, from_=6, to=18, textvariable=self.end_month_var, command=self.updateSpinbox)
     self.end_month_var.set(18)
     self.end_month.pack(anchor="w")
     # subject ranges
     self.chosen_subjects = range(1,47)
     self.choose_subjects = tk.Button(window, text="Choose subjects (default is all)", command = lambda:self.choose_subjects_window())
     self.choose_subjects.pack(anchor='w')
     # next button
     self.next_button = tk.Button(window, text="submit", command = self.getCheckboxVals)
     self.next_button.pack(side=tk.BOTTOM, pady=(10,0))
Ejemplo n.º 21
0
    def __init__(self, master, width, height, border, arrow_width):
        self.height = height * 13 / 17
        self.width = width * 4 / 18
        self.master = master
        self.arrow_width = arrow_width
        self.font_size = 6
        self.fs_data_up = [self.font_size * 3]
        self.fs_data_down = [self.font_size * 5]

        self.wheel_canvas = Tk.Canvas(master,
                                      bg="white",
                                      width=self.width,
                                      height=self.height,
                                      bd=border,
                                      highlightthickness=border)
        self.wheel_canvas.grid(row=2, column=13, rowspan=13, columnspan=4)

        self.wheel_canvas.create_polygon(self.width / 12,
                                         self.height * 15 / 32,
                                         self.width / 12,
                                         self.height * 17 / 32,
                                         self.width / 6,
                                         self.height / 2,
                                         fill="White",
                                         outline="Black")

        self.lines = [[] for i in range(3)]
        self.current_line = 0
        self.iterator = iter(self.lines[self.current_line])

        self.create_line(2 * arrow_width, self.height / 2, self.width / 12,
                         self.height / 2, 10, 0, 0)
        self.create_line(2 * arrow_width, self.height / 8, 2 * arrow_width,
                         self.height / 2, 0, 10, 1)
        self.create_line(0, self.height / 8, 2 * arrow_width, self.height / 8,
                         10, 0, 2)

        exit_point = self.wheel_canvas.coords(self.lines[2][0])
        self.exit_height = exit_point[1]

        # ringbuffer[8] is active, ringbuffer[7] is enlargen, ringbuffer[16] is delete, ringbuffer[0] is create
        self.ringbuffer_box = [None] * 15
        self.ringbuffer_data = [None] * 15
        self.command_sequence = []
        self.command_sequence_size = 0
        self.command_sequence_ptr = 0
        self.ringbuffer_ptr = 7
        self.shrunk = False
        self.enlarged = False
        self.target = 0
        self.cable_color = 'red'
        self.wheel_done = Tk.BooleanVar()
        self.flow_done = Tk.BooleanVar()
Ejemplo n.º 22
0
    def __init__(self, parent):
        self.super = self.__class__.__bases__[0]
        self.super.__init__(self,
                            parent,
                            vscrollmode='static',
                            horizflex='expand')

        # filter variables
        self.v_floaded = Tkinter.BooleanVar(parent, False)
        self.v_fstartup = Tkinter.BooleanVar(parent, False)

        self.reload()
Ejemplo n.º 23
0
 def __init__(self, parent, title, app, **kw):
     kw = self.initKw(kw)
     MfxDialog.__init__(self, parent, title, kw.resizable, kw.default)
     top_frame, bottom_frame = self.createFrames(kw)
     self.createBitmaps(top_frame, kw)
     self.app = app
     #
     self.update_stats_var = Tkinter.BooleanVar()
     self.update_stats_var.set(app.opt.update_player_stats != 0)
     self.confirm_var = Tkinter.BooleanVar()
     self.confirm_var.set(app.opt.confirm != 0)
     self.win_animation_var = Tkinter.BooleanVar()
     self.win_animation_var.set(app.opt.win_animation != 0)
     #
     frame = Tkinter.Frame(top_frame)
     frame.pack(expand=True, fill='both', padx=5, pady=10)
     widget = Tkinter.Label(
         frame,
         text=_("\nPlease enter your name"),
         #justify='left', anchor='w',
         takefocus=0)
     widget.grid(row=0, column=0, columnspan=2, sticky='ew', padx=0, pady=5)
     w = kw.get("e_width", 30)  # width in characters
     self.player_var = Tkinter.Entry(frame, exportselection=1, width=w)
     self.player_var.insert(0, app.opt.player)
     self.player_var.grid(row=1, column=0, sticky='ew', padx=0, pady=5)
     widget = Tkinter.Button(frame,
                             text=_('Choose...'),
                             command=self.selectUserName)
     widget.grid(row=1, column=1, padx=5, pady=5)
     widget = Tkinter.Checkbutton(frame,
                                  variable=self.confirm_var,
                                  anchor='w',
                                  text=_("Confirm quit"))
     widget.grid(row=2, column=0, columnspan=2, sticky='ew', padx=0, pady=5)
     widget = Tkinter.Checkbutton(frame,
                                  variable=self.update_stats_var,
                                  anchor='w',
                                  text=_("Update statistics and logs"))
     widget.grid(row=3, column=0, columnspan=2, sticky='ew', padx=0, pady=5)
     ###        widget = Tkinter.Checkbutton(frame, variable=self.win_animation_var,
     ###                                     text="Win animation")
     ###        widget.pack(side='top', padx=kw.padx, pady=kw.pady)
     frame.columnconfigure(0, weight=1)
     #
     self.player = self.player_var.get()
     self.confirm = self.confirm_var.get()
     self.update_stats = self.update_stats_var.get()
     self.win_animation = self.win_animation_var.get()
     #
     focus = self.createButtons(bottom_frame, kw)
     self.mainloop(focus, kw.timeout)
Ejemplo n.º 24
0
 def __init__(self, root, *args, **kwargs):
     tk.Frame.__init__(self, root, *args, **kwargs)
     self.root = root
     self.__filename = None
     self.__saved = tk.BooleanVar()
     self.__modified = tk.BooleanVar()
     self.build_editor()
     self.build_context_menu()
     root.bind_class("Text", "<Control-A>", self.select_all)
     root.bind_class("Text", "<Control-a>", self.select_all)
     self.config_tags()
     self.create_tags()
     self.set_lexer()
Ejemplo n.º 25
0
    def __init__(self, master, width, height, border):
        self.height = height * 15 / 17
        self.width = width * 2 / 18
        self.master = master
        self.font_size = 8
        self.fs_ix_up = [self.font_size]
        self.fs_ix_down = [self.font_size + (self.font_size / 2)]
        self.fs_data_up = [self.font_size * 3]
        self.fs_data_down = [self.font_size * 5]

        self.memory_canvas = Tk.Canvas(master,
                                       bg="white",
                                       width=self.width,
                                       height=self.height,
                                       bd=border,
                                       highlightthickness=border)
        self.memory_canvas.grid(row=1, column=1, rowspan=15, columnspan=2)

        self.memory_canvas.create_polygon(self.width / 12,
                                          self.height * 15 / 32,
                                          self.width / 12,
                                          self.height * 17 / 32,
                                          self.width / 6,
                                          self.height / 2,
                                          fill="White",
                                          outline="Black")

        self.memory_canvas.create_polygon(self.width * 11 / 12,
                                          self.height * 15 / 32,
                                          self.width * 11 / 12,
                                          self.height * 17 / 32,
                                          self.width * 5 / 6,
                                          self.height / 2,
                                          fill="White",
                                          outline="Black")

        # ringbuffer[8] is active, ringbuffer[7] is enlargen, ringbuffer[16] is delete, ringbuffer[0] is create
        self.ringbuffer_box = [None] * 19
        self.ringbuffer_index = [None] * 19
        self.ringbuffer_data = [None] * 19
        self.memory = []
        self.memory_ptr = 0
        self.ringbuffer_ptr = 9
        self.memory_size = 0
        self.shrunk = False
        self.enlarged = False
        self.target = 0
        self.color = None
        self.direction = None
        self.color_blink_done = Tk.BooleanVar()
        self.done = Tk.BooleanVar()
Ejemplo n.º 26
0
 def checkbutton(k, v):
     var = Tkinter.BooleanVar(f)
     var.set(v)
     g = Tkinter.Frame(f)
     w = Tkinter.Checkbutton(g, variable=var, text="Yes")
     w.pack(side="left")
     return g, var
Ejemplo n.º 27
0
    def buildSyntaxSubmenus(self, rootmenu):
        syntaxsubmenus = []
        syntaxoptions = []
        currentmenu = None
        firstLetter, startLetter = None, None
        for i, lexer in enumerate(sorted(get_all_lexers())):
            if not i % 20:
                if currentmenu:

                    rootmenu.add_cascade(label="Submenu {0}-{1}".format(
                        firstLetter, startLetter),
                                         menu=currentmenu)
                currentmenu = tk.Menu(rootmenu, tearoff=0)
                firstLetter = lexer[0][0]
                syntaxsubmenus.append(currentmenu)
            startLetter = lexer[0][0]
            newVar = tk.BooleanVar(self)
            callback = partial(self.setLexer, lexer[0])
            syntaxoptions.append((lexer[0], newVar, callback))
            currentmenu.add_checkbutton(label=lexer[0],
                                        variable=newVar,
                                        command=callback)

        rootmenu.add_cascade(label="Submenu {0}-{1}".format(
            firstLetter, startLetter),
                             menu=currentmenu)
        return syntaxsubmenus, syntaxoptions
Ejemplo n.º 28
0
    def __init__(self, abort_event, autobind=None):
        self.__queue = []
        self.__fun = None
        self.__args = None
        self.__abort = abort_event

        if autobind is not None:

            def create_handler(self, name):
                def handler(event):
                    self.add_event(name, event)

                return handler

            for widget, events_list in autobind.iteritems():
                for item in events_list:
                    try:
                        name, tkevent = item
                    except ValueError:
                        name = tkevent = item

                    if name is None:
                        raise ValueError("Event name cannot be None")

                    widget.bind(tkevent, create_handler(self, name))

        self.__root = Tkinter._default_root
        self.__flag = Tkinter.BooleanVar()
        self.__root.wait_visibility()

        # save old WM_DELETE_WINDOW handler, we will call it on exit
        self.__delete_command = self.__root.protocol('WM_DELETE_WINDOW')
        self.__root.protocol('WM_DELETE_WINDOW', self.__delete)
    def add_named_checkbutton(self, name, **kw):
        if 'variable' in kw:
            var = kw['variable']
        else:
            var = tk.BooleanVar(value=kw.pop('value', False))
            kw['variable'] = var
        command = kw.pop('command', None)
        statevar = kw.pop('statevariable', None)
        event = kw.pop('event', None)

        setattr(self, self._PREFIX_INDEX + name, kw['label'])
        setattr(self, self._PREFIX_INDEX + name + '_variable', var)
        self.add_checkbutton(**kw)

        if command != None:
            var.trace(
                tkc.TRACE_WRITE,
                lambda varname, index, operation: command(bool(var.get())))

        if statevar != None:
            stateListener = lambda a, b, c: self.entry_enable(
                name) if statevar.get() else self.entry_disable(name)
            stateListener(None, None, None)
            statevar.trace('w', stateListener)

        if event != None:
            self.bindElement(name, event, wrapper=only)
Ejemplo n.º 30
0
    def __init__(self,
                 root,
                 entry_type=str,
                 label='Input',
                 title='GradeBook',
                 font="Helvetica",
                 fontsize=12,
                 entry_width=25):
        tk.Toplevel.__init__(self)
        self.title(title)
        self.bind("<Return>", self.enter)

        if entry_type is str:
            self.var = tk.StringVar()
        elif entry_type is int:
            self.var = tk.IntVar()
        elif entry_type is bool:
            self.var = tk.BooleanVar()
        elif entry_type is float:
            self.var = tk.DoubleVar()
        else:
            self.var = tk.StringVar()

        self.value = None

        self.label = tk.Label(self, text=label, font=(font, fontsize))
        self.entry = tk.Entry(self, textvariable=self.var, width=entry_width)

        self.label.grid(row=0, column=0)
        self.entry.grid(row=0, column=1)
        self.entry.focus_set()
        self.wait_window()