Python Tkinter.IntVar() Examples

The following are 30 code examples of Tkinter.IntVar(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module Tkinter , or try the search function .
Example #1
Source File: eddn.py    From EDMarketConnector with GNU General Public License v2.0 7 votes vote down vote up
def plugin_prefs(parent, cmdr, is_beta):

    PADX = 10
    BUTTONX = 12	# indent Checkbuttons and Radiobuttons
    PADY = 2		# close spacing

    output = config.getint('output') or (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN)	# default settings

    eddnframe = nb.Frame(parent)

    HyperlinkLabel(eddnframe, text='Elite Dangerous Data Network', background=nb.Label().cget('background'), url='https://github.com/EDSM-NET/EDDN/wiki', underline=True).grid(padx=PADX, sticky=tk.W)	# Don't translate
    this.eddn_station= tk.IntVar(value = (output & config.OUT_MKT_EDDN) and 1)
    this.eddn_station_button = nb.Checkbutton(eddnframe, text=_('Send station data to the Elite Dangerous Data Network'), variable=this.eddn_station, command=prefsvarchanged)	# Output setting
    this.eddn_station_button.grid(padx=BUTTONX, pady=(5,0), sticky=tk.W)
    this.eddn_system = tk.IntVar(value = (output & config.OUT_SYS_EDDN) and 1)
    this.eddn_system_button = nb.Checkbutton(eddnframe, text=_('Send system and scan data to the Elite Dangerous Data Network'), variable=this.eddn_system, command=prefsvarchanged)	# Output setting new in E:D 2.2
    this.eddn_system_button.grid(padx=BUTTONX, pady=(5,0), sticky=tk.W)
    this.eddn_delay= tk.IntVar(value = (output & config.OUT_SYS_DELAY) and 1)
    this.eddn_delay_button = nb.Checkbutton(eddnframe, text=_('Delay sending until docked'), variable=this.eddn_delay)	# Output setting under 'Send system and scan data to the Elite Dangerous Data Network' new in E:D 2.2
    this.eddn_delay_button.grid(padx=BUTTONX, sticky=tk.W)

    return eddnframe 
Example #2
Source File: Controls.py    From Python-Media-Player with Apache License 2.0 6 votes vote down vote up
def __init__(self, root=None):
        self.root=Tkinter.Frame(root)
        self.root.pack(side='top')
        
        self.path=Tkinter.StringVar()           # For Song Path
        self.song_time=Tkinter.StringVar()      # For Song Playing Time
        self.song_duration=Tkinter.StringVar()  # For Song Duration
        self.volume=Tkinter.IntVar()            # For Song Volume

        # ============= Creating Media Player       ======================================================
        mediaplayer=player.mediaplayer(self.path, self.song_time, self.song_duration, self.volume)

        # ============= Creating Display Panel      ======================================================
        DisplayPanel.Player(self.root, self.path, self.song_time, self.song_duration)

        # ============= Creating Control Panel      ======================================================
        lit2=Controls(self.root, self.path, mediaplayer, self.volume)
        self.hook2=lit2
        # ============= Here Connecting List Panel  ======================================================
        lit=ListPanel.main(self.root, self.path)
        self.hook=lit.hook 
Example #3
Source File: gui_widgets.py    From SVPV with MIT License 6 votes vote down vote up
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent)
        self.title = tk.Label(self, text='SV Length')

        self.len_GT_On = tk.IntVar(value=0)
        self.len_GT_On_CB = tk.Checkbutton(self, text=">", justify=tk.LEFT, variable=self.len_GT_On)
        self.len_GT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
        self.len_GT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)

        self.len_LT_On = tk.IntVar(value=0)
        self.len_LT_On_CB = tk.Checkbutton(self, text="<", justify=tk.LEFT, variable=self.len_LT_On)
        self.len_LT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3)
        self.len_LT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3)

        self.title.grid(row=0, column=0, sticky=tk.EW, columnspan=4)
        self.len_GT_On_CB.grid(row=1, column=0, sticky=tk.EW)
        self.len_GT_val.grid(row=2, column=0, sticky=tk.EW)
        self.len_GT_Units.grid(row=2, column=1, sticky=tk.EW)
        self.len_LT_On_CB.grid(row=1, column=2, sticky=tk.EW)
        self.len_LT_val.grid(row=2, column=2, sticky=tk.EW)
        self.len_LT_Units.grid(row=2, column=3, sticky=tk.EW) 
Example #4
Source File: juegochozas.py    From Tutoriales_juegos_Python with GNU General Public License v3.0 6 votes vote down vote up
def crear_widgets(self):

        self.var = IntVar()
        self.background_label = Label(self.container,
                                      image=self.imagen_fondo)
        txt = "Selecciona una choza en la que entrar. Ganarás si:\n"
        txt += "La choza está vacia o si su ocupante es tu aliado, de lo contrario morirás"
        self.info_label = Label(self.container, text=txt, bg='white')
        # Creamos un dicionario con las opciones para las imagenes de las chozas
        r_btn_config = {'variable': self.var,
                        'bg': '#8AA54C',
                        'activebackground': 'green',
                        'image': self.imagen_choza,
                        'height': self.alto_choza,
                        'width': self.ancho_choza,
                        'command': self.radio_btn_pressed}

        self.r1 = Radiobutton(self.container, r_btn_config, value=1)
        self.r2 = Radiobutton(self.container, r_btn_config, value=2)
        self.r3 = Radiobutton(self.container, r_btn_config, value=3)
        self.r4 = Radiobutton(self.container, r_btn_config, value=4)
        self.r5 = Radiobutton(self.container, r_btn_config, value=5) 
Example #5
Source File: backend_tkagg.py    From Computable with MIT License 6 votes vote down vote up
def adjust(self, naxes):
        if self._naxes < naxes:
            for i in range(self._naxes, naxes):
                self._axis_var.append(Tk.IntVar())
                self._axis_var[i].set(1)
                self._checkbutton.append( self._mbutton.menu.add_checkbutton(
                    label = "Axis %d" % (i+1),
                    variable=self._axis_var[i],
                    command=self.set_active))
        elif self._naxes > naxes:
            for i in range(self._naxes-1, naxes-1, -1):
                del self._axis_var[i]
                self._mbutton.menu.forget(self._checkbutton[i])
                del self._checkbutton[i]
        self._naxes = naxes
        self.set_active() 
Example #6
Source File: backend_tkagg.py    From matplotlib-4-abaqus with MIT License 6 votes vote down vote up
def adjust(self, naxes):
        if self._naxes < naxes:
            for i in range(self._naxes, naxes):
                self._axis_var.append(Tk.IntVar())
                self._axis_var[i].set(1)
                self._checkbutton.append( self._mbutton.menu.add_checkbutton(
                    label = "Axis %d" % (i+1),
                    variable=self._axis_var[i],
                    command=self.set_active))
        elif self._naxes > naxes:
            for i in range(self._naxes-1, naxes-1, -1):
                del self._axis_var[i]
                self._mbutton.menu.forget(self._checkbutton[i])
                del self._checkbutton[i]
        self._naxes = naxes
        self.set_active() 
Example #7
Source File: ScribusGenerator.py    From ScribusGenerator with MIT License 5 votes vote down vote up
def __init__(self, root):
        self.__dataSourceFileEntryVariable = StringVar()
        self.__scribusSourceFileEntryVariable = StringVar()
        self.__dataSeparatorEntryVariable = StringVar()
        self.__dataSeparatorEntryVariable.set(CONST.CSV_SEP)
        self.__outputDirectoryEntryVariable = StringVar()
        self.__outputFileNameEntryVariable = StringVar()
        # SLA & PDF are valid output format
        self.__outputFormatList = [CONST.FORMAT_PDF, CONST.FORMAT_SLA]
        self.__selectedOutputFormat = StringVar()
        self.__selectedOutputFormat.set(CONST.FORMAT_PDF)
        self.__keepGeneratedScribusFilesCheckboxVariable = IntVar()
        self.__mergeOutputCheckboxVariable = IntVar()
        self.__saveCheckboxVariable = IntVar()
        self.__fromVariable = StringVar()
        self.__fromVariable.set(CONST.EMPTY)
        self.__toVariable = StringVar()
        self.__toVariable.set(CONST.EMPTY)
        self.__closeDialogVariable = IntVar()
        self.__root = root
        if scribus.haveDoc():
            doc = scribus.getDocName()
            self.__scribusSourceFileEntryVariable.set(doc)
            self.__outputDirectoryEntryVariable.set(os.path.split(doc)[0])
            self.__dataSourceFileEntryVariable.set(
                os.path.splitext(doc)[0]+".csv") 
Example #8
Source File: demo.py    From PyCV-time with MIT License 5 votes vote down vote up
def match_text(self, pattern, tag_proc, regexp=True):
        text = self.text
        text.mark_set('matchPos', '1.0')
        count = tk.IntVar()
        while True:
            match_index = text.search(pattern, 'matchPos', count=count, regexp=regexp, stopindex='end')
            if not match_index: break
            end_index = text.index( "%s+%sc" % (match_index, count.get()) )
            text.mark_set('matchPos', end_index)
            if callable(tag_proc):
                tag_proc(match_index, end_index, text.get(match_index, end_index))
            else:
                text.tag_add(tag_proc, match_index, end_index) 
Example #9
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def test_invoke(self):
        success = []
        def cb_test():
            success.append(1)
            return "cb test called"

        myvar = tkinter.IntVar(self.root)
        cbtn = ttk.Radiobutton(self.root, command=cb_test,
                               variable=myvar, value=0)
        cbtn2 = ttk.Radiobutton(self.root, command=cb_test,
                                variable=myvar, value=1)

        if self.wantobjects:
            conv = lambda x: x
        else:
            conv = int

        res = cbtn.invoke()
        self.assertEqual(res, "cb test called")
        self.assertEqual(conv(cbtn['value']), myvar.get())
        self.assertEqual(myvar.get(),
            conv(cbtn.tk.globalgetvar(cbtn['variable'])))
        self.assertTrue(success)

        cbtn2['command'] = ''
        res = cbtn2.invoke()
        self.assertEqual(str(res), '')
        self.assertLessEqual(len(success), 1)
        self.assertEqual(conv(cbtn2['value']), myvar.get())
        self.assertEqual(myvar.get(),
            conv(cbtn.tk.globalgetvar(cbtn['variable'])))

        self.assertEqual(str(cbtn['variable']), str(cbtn2['variable'])) 
Example #10
Source File: test_extensions.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def test_widget_destroy(self):
        # automatically created variable
        x = ttk.LabeledScale(self.root)
        var = x._variable._name
        x.destroy()
        self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var)

        # manually created variable
        myvar = tkinter.DoubleVar(self.root)
        name = myvar._name
        x = ttk.LabeledScale(self.root, variable=myvar)
        x.destroy()
        if self.wantobjects:
            self.assertEqual(x.tk.globalgetvar(name), myvar.get())
        else:
            self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get())
        del myvar
        self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name)

        # checking that the tracing callback is properly removed
        myvar = tkinter.IntVar(self.root)
        # LabeledScale will start tracing myvar
        x = ttk.LabeledScale(self.root, variable=myvar)
        x.destroy()
        # Unless the tracing callback was removed, creating a new
        # LabeledScale with the same var will cause an error now. This
        # happens because the variable will be set to (possibly) a new
        # value which causes the tracing callback to be called and then
        # it tries calling instance attributes not yet defined.
        ttk.LabeledScale(self.root, variable=myvar)
        if hasattr(sys, 'last_type'):
            self.assertNotEqual(sys.last_type, tkinter.TclError) 
Example #11
Source File: ScribusGenerator.py    From ScribusGenerator with MIT License 5 votes vote down vote up
def scribusLoadSettingsHandler(self):
        slaFile = self.__scribusSourceFileEntryVariable.get()

        if(slaFile is CONST.EMPTY):
            tkMessageBox.showinfo(
                'Choose a file', message="Set a valid scribus input file prior to loading its settings.")
            return
        dataObject = GeneratorDataObject(
            scribusSourceFile=slaFile
        )
        generator = ScribusGenerator(dataObject)
        saved = generator.getSavedSettings()
        if (saved):
            dataObject.loadFromString(saved)
            # self.__scribusSourceFileEntryVariable = StringVar() #not loaded
            self.__dataSourceFileEntryVariable.set(
                dataObject.getDataSourceFile())
            self.__dataSeparatorEntryVariable.set(dataObject.getCsvSeparator())
            self.__outputDirectoryEntryVariable.set(
                dataObject.getOutputDirectory())
            self.__outputFileNameEntryVariable.set(
                dataObject.getOutputFileName())
            self.__selectedOutputFormat.set(dataObject.getOutputFormat())
            self.__keepGeneratedScribusFilesCheckboxVariable.set(
                dataObject.getKeepGeneratedScribusFiles())
            self.__mergeOutputCheckboxVariable.set(
                dataObject.getSingleOutput())
            # self.__saveCheckboxVariable = IntVar() #not loaded
            self.__fromVariable.set(dataObject.getFirstRow())
            self.__toVariable.set(dataObject.getLastRow())
            self.__closeDialogVariable.set(dataObject.getCloseDialog())
        else:
            tkMessageBox.showinfo(
                'No Settings', message="Input scribus file contains no former saved settings.") 
Example #12
Source File: ListPanel.py    From Python-Media-Player with Apache License 2.0 5 votes vote down vote up
def __init__(self, root, var1):
        self.playing=var1
        self.root=Tkinter.Frame(root)
        self.root.pack()
        self.anchorvar=Tkinter.IntVar()
        self.anchorvar.set(1)
        self.anchor_button=Tkinter.Button(self.root, text='[ Close ]', command=self.check_drawer, bg='skyblue', activebackground='powderblue')
        self.anchor_button.pack(side='top',expand='yes',fill='x')
        self.mainframe=Tkinter.Frame(self.root)
        self.mainframe.pack()
        obj=ListPanel(self.mainframe, self.playing)
        self.hook=obj 
Example #13
Source File: guiClass.py    From Video-Downloader with GNU General Public License v2.0 5 votes vote down vote up
def __configPanel (self) :
		self.slave = Tkinter.Toplevel();

		self.slave.title("Config")
		self.slave.resizable(width = 'false', height = 'false')

		l1 = Tkinter.Label(self.slave, text = '下载目录:')
		l1.grid(row = 0)

		self.filePath = Tkinter.StringVar()
		self.filePath.set(self.cfg['path'])
		e1 = Tkinter.Entry(self.slave, textvariable = self.filePath)
		e1.grid(row = 0, column = 1, columnspan = 3)

		b1 = Tkinter.Button(self.slave, text = '选择', command = self.__chooseCfgFolder)
		b1.grid(row = 0, column = 4, sticky = 'e')

		l2 = Tkinter.Label(self.slave, text = '检查更新:')
		l2.grid(row = 1)

		self.chkUpdateTime = Tkinter.IntVar()
		self.chkUpdateTime.set(int(self.cfg['udrate']))
		r1 = Tkinter.Radiobutton(self.slave, text="每天", variable=self.chkUpdateTime, value=1)
		r1.grid(row = 1, column = 1, sticky = 'e')
		r2 = Tkinter.Radiobutton(self.slave, text="每周", variable=self.chkUpdateTime, value=2)
		r2.grid(row = 1, column = 2, sticky = 'e')
		r3 = Tkinter.Radiobutton(self.slave, text="每月", variable=self.chkUpdateTime, value=3)
		r3.grid(row = 1, column = 3, sticky = 'e')

		b2 = Tkinter.Button(self.slave, text = '更新', command = self.__setConfig)
		b2.grid(row = 2, column = 1, sticky = 'e')

		b3 = Tkinter.Button(self.slave, text = '取消', command = self.slave.destroy)
		b3.grid(row = 2, column = 2, sticky = 'e') 
Example #14
Source File: cheetah_config_support.py    From cheetah-gui with GNU General Public License v3.0 5 votes vote down vote up
def set_tk_var():
    global method
    method = StringVar()
    method.set(read_config("Config", "Method", "str"))
    global server
    server = StringVar()
    server.set(read_config("Config", "Server", "str"))
    global shelltype
    shelltype = StringVar()
    shelltype.set(read_config("Config", "ShellType", "str"))
    global parameter
    parameter = StringVar()
    parameter.set(read_config("Config", "Parameter", "str"))
    global thread_num
    thread_num = IntVar()
    thread_num.set(read_config("Config", "ThreadNumber", "int"))
    global req_delay
    req_delay = DoubleVar()
    req_delay.set(read_config("Config", "RequestDelay", "float"))
    global time_out
    time_out = DoubleVar()
    time_out.set(read_config("Config", "RequestTimeout", "float"))
    global random_ua
    random_ua = BooleanVar()
    random_ua.set(read_config("Config", "RandomUserAgent", "boolean"))
    global con_close
    con_close = BooleanVar()
    con_close.set(read_config("Config", "ConnectionClose", "boolean"))
    global keep_alive
    keep_alive = BooleanVar()
    keep_alive.set(read_config("Config", "KeepAlive0", "boolean"))
    global custom_hdr
    custom_hdr = BooleanVar()
    custom_hdr.set(read_config("Config", "CustomRequestHeader", "boolean"))
    global custom_hdr_data
    custom_hdr_data = StringVar()
    custom_hdr_data.set(read_config("Config", "CustomRequestHeaderData", "str")) 
Example #15
Source File: ttk.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, master=None, variable=None, from_=0, to=10, **kw):
        """Construct an horizontal LabeledScale with parent master, a
        variable to be associated with the Ttk Scale widget and its range.
        If variable is not specified, a Tkinter.IntVar is created.

        WIDGET-SPECIFIC OPTIONS

            compound: 'top' or 'bottom'
                Specifies how to display the label relative to the scale.
                Defaults to 'top'.
        """
        self._label_top = kw.pop('compound', 'top') == 'top'

        Frame.__init__(self, master, **kw)
        self._variable = variable or Tkinter.IntVar(master)
        self._variable.set(from_)
        self._last_valid = from_

        self.label = Label(self)
        self.scale = Scale(self, variable=self._variable, from_=from_, to=to)
        self.scale.bind('<<RangeChanged>>', self._adjust)

        # position scale and label according to the compound option
        scale_side = 'bottom' if self._label_top else 'top'
        label_side = 'top' if scale_side == 'bottom' else 'bottom'
        self.scale.pack(side=scale_side, fill='x')
        tmp = Label(self).pack(side=label_side) # place holder
        self.label.place(anchor='n' if label_side == 'top' else 's')

        # update the label as scale or variable changes
        self.__tracecb = self._variable.trace_variable('w', self._adjust)
        self.bind('<Configure>', self._adjust)
        self.bind('<Map>', self._adjust) 
Example #16
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        self.var1 = tk.IntVar()
        self.var2 = tk.IntVar()

        tk.Label(self, text="These are checkbuttons").pack()

        tk.Checkbutton(self, text='Pick me!', variable=self.var1, command=self.checked).pack()

        tk.Checkbutton(self, text='Or pick me!', variable=self.var2, command=self.checked).pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #17
Source File: Controls.py    From Python-Media-Player with Apache License 2.0 5 votes vote down vote up
def __init__(self, root, playing, player, volume):
        self.playervolume=volume
        self.root=Tkinter.Frame(root)
        self.root.pack()
        self.status=Tkinter.IntVar() # For Song Status
        self.playing=playing
        self.player=player
        self.var=Tkinter.IntVar() # For Volume Bar
        self.var.set(1.0)
        self.songtime=Tkinter.IntVar()
        self.create_control_panel()
        #self.time_thread()
        #print self.player.playing 
Example #18
Source File: example.py    From GooMPy with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self):

        tk.Tk.__init__(self)

        self.geometry('%dx%d+500+500' % (WIDTH,HEIGHT))
        self.title('GooMPy')

        self.canvas = tk.Canvas(self, width=WIDTH, height=HEIGHT)

        self.canvas.pack()

        self.bind("<Key>", self.check_quit)
        self.bind('<B1-Motion>', self.drag)
        self.bind('<Button-1>', self.click)

        self.label = tk.Label(self.canvas)

        self.radiogroup = tk.Frame(self.canvas)
        self.radiovar = tk.IntVar()
        self.maptypes = ['roadmap', 'terrain', 'satellite', 'hybrid']
        self.add_radio_button('Road Map',  0)
        self.add_radio_button('Terrain',   1)
        self.add_radio_button('Satellite', 2)
        self.add_radio_button('Hybrid',    3)

        self.zoom_in_button  = self.add_zoom_button('+', +1)
        self.zoom_out_button = self.add_zoom_button('-', -1)

        self.zoomlevel = ZOOM

        maptype_index = 0
        self.radiovar.set(maptype_index)

        self.goompy = GooMPy(WIDTH, HEIGHT, LATITUDE, LONGITUDE, ZOOM, MAPTYPE)

        self.restart() 
Example #19
Source File: demo.py    From PyCV-time with MIT License 5 votes vote down vote up
def match_text(self, pattern, tag_proc, regexp=True):
        text = self.text
        text.mark_set('matchPos', '1.0')
        count = tk.IntVar()
        while True:
            match_index = text.search(pattern, 'matchPos', count=count, regexp=regexp, stopindex='end')
            if not match_index:
                break
            end_index = text.index( "%s+%sc" % (match_index, count.get()) )
            text.mark_set('matchPos', end_index)
            if callable(tag_proc):
                tag_proc(match_index, end_index, text.get(match_index, end_index))
            else:
                text.tag_add(tag_proc, match_index, end_index) 
Example #20
Source File: base_dialog.py    From PCWG with MIT License 5 votes vote down vote up
def addCheckBox(self, master, title, value):

        label = tk.Label(master, text=title)
        label.grid(row=self.row, sticky=tk.W, column=self.labelColumn)
        variable = tk.IntVar(master, value)

        checkButton = tk.Checkbutton(master, variable=variable)
        checkButton.grid(row=self.row, column=self.inputColumn, sticky=tk.W)

        self.row += 1

        return variable 
Example #21
Source File: DeepBrainSegUI_support.py    From DeepBrainSeg with MIT License 5 votes vote down vote up
def set_Tk_var():
    global progress_bar
    progress_bar = tk.IntVar()
    global selectedButton
    selectedButton = tk.StringVar() 
Example #22
Source File: tree.py    From luscan-devel with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, *trees):
        from math import sqrt, ceil

        self._trees = trees

        self._top = Tk()
        self._top.title('NLTK')
        self._top.bind('<Control-x>', self.destroy)
        self._top.bind('<Control-q>', self.destroy)

        cf = self._cframe = CanvasFrame(self._top)
        self._top.bind('<Control-p>', self._cframe.print_to_file)

        # Size is variable.
        self._size = IntVar(self._top)
        self._size.set(12)
        bold = ('helvetica', -self._size.get(), 'bold')
        helv = ('helvetica', -self._size.get())

        # Lay the trees out in a square.
        self._width = int(ceil(sqrt(len(trees))))
        self._widgets = []
        for i in range(len(trees)):
            widget = TreeWidget(cf.canvas(), trees[i], node_font=bold,
                                leaf_color='#008040', node_color='#004080',
                                roof_color='#004040', roof_fill='white',
                                line_color='#004040', draggable=1,
                                leaf_font=helv)
            widget.bind_click_trees(widget.toggle_collapsed)
            self._widgets.append(widget)
            cf.add_widget(widget, 0, 0)

        self._layout()
        self._cframe.pack(expand=1, fill='both')
        self._init_menubar() 
Example #23
Source File: chartparser_app.py    From luscan-devel with GNU General Public License v2.0 5 votes vote down vote up
def _init_animation(self):
        # Are we stepping? (default=yes)
        self._step = Tkinter.IntVar(self._root)
        self._step.set(1)

        # What's our animation speed (default=fast)
        self._animate = Tkinter.IntVar(self._root)
        self._animate.set(3) # Default speed = fast

        # Are we currently animating?
        self._animating = 0 
Example #24
Source File: chartparser_app.py    From luscan-devel with GNU General Public License v2.0 5 votes vote down vote up
def _init_fonts(self, root):
        # See: <http://www.astro.washington.edu/owen/ROTKFolklore.html>
        self._sysfont = tkFont.Font(font=Tkinter.Button()["font"])
        root.option_add("*Font", self._sysfont)

        # TWhat's our font size (default=same as sysfont)
        self._size = Tkinter.IntVar(root)
        self._size.set(self._sysfont.cget('size'))

        self._boldfont = tkFont.Font(family='helvetica', weight='bold',
                                    size=self._size.get())
        self._font = tkFont.Font(family='helvetica',
                                    size=self._size.get()) 
Example #25
Source File: simple_beam.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_load(self, *event):

        self.loads_gui_select_var.append([tk.IntVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar()])

        n = len(self.loads_gui_select_var)
        self.loads_gui_select_var[n-1][0].set(1)
        self.loads_gui_select_var[n-1][1].set(self.w1_gui.get())
        self.loads_gui_select_var[n-1][2].set(self.w2_gui.get())
        self.loads_gui_select_var[n-1][3].set(self.a_gui.get())
        self.loads_gui_select_var[n-1][4].set(self.b_gui.get())
        self.loads_gui_select_var[n-1][5].set(self.load_loc.get())
        self.loads_gui_select_var[n-1][6].set(self.load_type.get())

        self.build_loads_gui()
        self.build_loads() 
Example #26
Source File: simple_beam_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_load(self, *event):

        self.loads_gui_select_var.append([tk.IntVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar(), tk.StringVar()])

        n = len(self.loads_gui_select_var)
        self.loads_gui_select_var[n-1][0].set(1)
        self.loads_gui_select_var[n-1][1].set(self.w1_gui.get())
        self.loads_gui_select_var[n-1][2].set(self.w2_gui.get())
        self.loads_gui_select_var[n-1][3].set(self.a_gui.get())
        self.loads_gui_select_var[n-1][4].set(self.b_gui.get())
        self.loads_gui_select_var[n-1][5].set(self.load_loc.get())
        self.loads_gui_select_var[n-1][6].set(self.load_type.get())

        self.build_loads_gui()
        self.build_loads() 
Example #27
Source File: __main__.py    From PyQuiz with MIT License 5 votes vote down vote up
def __init__(self, master=None):
    	'''

	
		Call to the constructor when the object is created.
		Variables initialized and set the grid as per need.
	

    	'''

	


        tkMessageBox.showinfo('Welcome!','Welcome to PyQuiz!\nA quiz built in Python to test your general knowledge.')
        tk.Frame.__init__(self, master)
        self.flag=0
        self.grid()
        # declaring variables to store question and answer
        self.optionA = tk.StringVar() # control variable for option A
        self.optionB = tk.StringVar() # control variable for option B
        self.optionC = tk.StringVar() # control variable for option C
        self.optionD = tk.StringVar() # control variable for option D
        self.selected_answer = tk.StringVar() # variable to get the selected answer
        self.correct_answer = "" # to store the correct answer before randomizing options
        self.question = tk.StringVar() # control variable for the question to be loaded
        self.file = open(QUESTIONS_FILE,"r")
        self.questions = json.loads(self.file.read())
        self.question_index = []
        self.score = tk.IntVar() # to hold the score
        top = self.winfo_toplevel()
        self.createWidgets(top) # call to create the necessary widgets
        self.load_question(top) # load the first question 
Example #28
Source File: __main__.py    From PyQuiz with MIT License 5 votes vote down vote up
def __init__(self, master=None):
    	'''

	
		Call to the constructor when the object is created.
		Variables initialized and set the grid as per need.
	

    	'''

	


        tkMessageBox.showinfo('Welcome!','Welcome to PyQuiz!\nA quiz built in Python to test your general knowledge.')
        tk.Frame.__init__(self, master)
        self.flag=0
        self.grid()
        # declaring variables to store question and answer
        self.optionA = tk.StringVar() # control variable for option A
        self.optionB = tk.StringVar() # control variable for option B
        self.optionC = tk.StringVar() # control variable for option C
        self.optionD = tk.StringVar() # control variable for option D
        self.selected_answer = tk.StringVar() # variable to get the selected answer
        self.correct_answer = "" # to store the correct answer before randomizing options
        self.question = tk.StringVar() # control variable for the question to be loaded
        self.file = open(QUESTIONS_FILE,"r")
        self.questions = json.loads(self.file.read())
        self.question_index = []
        self.score = tk.IntVar() # to hold the score
        top = self.winfo_toplevel()
        self.createWidgets(top) # call to create the necessary widgets
        self.load_question(top) # load the first question 
Example #29
Source File: svm_gui.py    From sklearn_pydata2015 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, model):
        self.model = model
        self.kernel = Tk.IntVar()
        self.surface_type = Tk.IntVar()
        # Whether or not a model has been fitted
        self.fitted = False 
Example #30
Source File: gui.py    From stochopy with MIT License 5 votes vote down vote up
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)