Ejemplo n.º 1
0
def session():
    wsession = tk.Toplevel(gui)

    ttk.Label(wsession, text="Session time (in sec): ").pack()
    stimeinput = ttk.Entry(wsession, width=10)
    stimeinput.insert(tk.END, str(sessiontime))
    stimeinput.pack()

    ttk.Label(wsession, text="Break time (in sec): ").pack()
    btimeinput = ttk.Entry(wsession, width=10)
    btimeinput.insert(tk.END, str(breaktime))
    btimeinput.pack()

    def done():
        global sessiontime, stime_min, stime_sec, onesec, breaktime, btime_min, btime_sec
        sessiontime = int(stimeinput.get())
        stime_min = sessiontime // 60
        stime_sec = sessiontime % 60
        onesec = 360 / sessiontime

        breaktime = int(btimeinput.get())
        btime_min = breaktime // 60
        btime_sec = breaktime % 60

        wsetting()

    ttk.Button(wsession, text="Ok!", command=done).pack()
    ttk.Label(wsession, text="_________________________________").pack()

    btn1 = AskButtons(wsession, "Advanced settings?", 0)
    #btn2 = AskButtons(wsession, "Unlimited session time?", 1) # Don't enable this!
    btn3 = AskButtons(wsession, "Disable breaktime?", 2)
Ejemplo n.º 2
0
def about_dialog():
    win = tk.Toplevel()
    win.title("About")
    win.configure(bg="#e7e7e7")
    win.resizable(0,0)

    img = ImageTk.PhotoImage(Image.open("app.gif").resize((128, 128), Image.ANTIALIAS))
    icon = ttk.Label(win, image=img)
    icon.image = img
    name = ttk.Label(win, text="Open Source Synology Cloud Sync Decryption Tool", font="San\ Francisco 14 bold")
    copytext = "© " + str(datetime.datetime.now().year) + " - Created by Anojh Thayaparan"
    author = ttk.Label(win, text=copytext)
    license = tk.Text(win, height=8, width=31, font="San\ Francisco 12", wrap='word')
    license.insert("1.0", "\nLICENSE:\n This app is provided as is to the user, without any liabilities, warranties or guarantees from the author. Any damages arising from use or misuse of the software is not a liability of the author.\nFor more information refer to the COPYRIGHTS file shipped with the application.")
    license.tag_config("center", justify='center')
    license.tag_add("center", "1.0", "end")
    license.config(state='disabled', highlightbackground='grey', highlightcolor='grey', borderwidth=1, highlightthickness=1)
    support = ttk.Button(win, text="Support", command=lambda: open_url("https://github.com/anojht/synology-cloud-sync-decrypt-tool/issues"))
    donate = ttk.Button(win, text="Donate", command=lambda: open_url("https://www.paypal.me/Anojh"))

    icon.grid(row=0, column=1, padx=10)
    name.grid(row=1, column=1, padx=10)
    author.grid(row=2, column=1)
    license.grid(row=3, column=1, pady=10)
    donate.grid(row=4, column=1, padx=(0,80), pady=(0,5))
    support.grid(row=4, column=1, padx=(90,0), pady=(0,5))
Ejemplo n.º 3
0
    def _createWidgets(self):
        self.plot_area = ttk.Frame(self)
        self.plot_area.pack(side='top', fill="both")

        self.user_area = ttk.Frame(self)
        self.user_area.pack(side='bottom', fill='x')

        # plot stuff
        # TODO add a second yaxis for RH
        # TODO add a nice style: http://matplotlib.org/examples/style_sheets/plot_fivethirtyeight.html
        fig = Figure()
        canvas = FigureCanvasTkAgg(fig, self.plot_area)
        canvas.draw()
        toolbar = NavigationToolbar2TkAgg(canvas, self.plot_area)
        toolbar.update()
        toolbar.pack(side="top")
        canvas.get_tk_widget().pack(side="top", fill="both", expand=True)

        graph = fig.add_subplot(1, 1, 1)
        graph.set_ylabel("Temperature $^\circ C$", size=18)
        graph.set_ylim(-20, 80)
        graph.grid()

        # buttons and labels stuff
        ## buttons
        self.buttons_area = ttk.Frame(self.user_area)
        self.buttons_area.pack(side='right', fill='y')
        self.buttons_area.rowconfigure(0, weight=1, uniform=1)
        self.buttons_area.rowconfigure(1, weight=1, uniform=1)

        self.startButton = ttk.Button(self.buttons_area, text='Start')
        self.stopButton = ttk.Button(self.buttons_area,
                                     text='Stop',
                                     command=self.quit)
        self.startButton.grid(row=0)
        self.stopButton.grid(row=1)

        ## labels
        self.labels_area = ttk.Frame(self.user_area)
        self.labels_area.pack(side='left', fill='y')

        self.TempLabel = ttk.Label(self.labels_area,
                                   text=u"Current Temperature:")
        self.HumLabel = ttk.Label(self.labels_area, text=u"Current Humidity:")
        self.TempLabel.grid(row=0, sticky='W')
        self.HumLabel.grid(row=1, sticky='W')

        self.lastTempLabel = ttk.Label(self.labels_area,
                                       textvariable=self.lastTemperature)
        self.lastHumLabel = ttk.Label(self.labels_area,
                                      textvariable=self.lastHumidity)
        self.lastTempLabel.grid(row=0, column=1, sticky='W')
        self.lastHumLabel.grid(row=1, column=1, sticky='W')
Ejemplo n.º 4
0
 def __init__(self, root, question, value):
     global settings
     self.root = root
     try:
         self.lastval = settings[value]
     except IndexError:
         settings.append("0")
         self.lastval = "0"
     self.question = question
     self.value = value
     ttk.Label(self.root, text=self.question).pack()
     self.currentval = ttk.Label(
         self.root,
         text=("Currently: " +
               ("Enabled" if settings[self.value] == "1" else "Disabled")))
     self.currentval.pack()
     self.button = ttk.Button(
         self.root,
         text=("Enable" if settings[self.value] == "0" else "Disable"),
         command=self.change)
     self.button.pack()
Ejemplo n.º 5
0
    def __place_widgets(self):
        # header frame and its widgets
        hframe = ttk.Frame(self)
        lbtn = ttk.Button(hframe, style='L.TButton', command=self._prev_month)
        rbtn = ttk.Button(hframe, style='R.TButton', command=self._next_month)
        self._header = ttk.Label(hframe, width=15, anchor='center')
        # the calendar
        self._calendar = ttk.Treeview(self, show='', selectmode='none', height=7)

        # pack the widgets
        hframe.pack(in_=self, side='top', pady=4, anchor='center')
        lbtn.grid(in_=hframe)
        self._header.grid(in_=hframe, column=1, row=0, padx=12)
        rbtn.grid(in_=hframe, column=2, row=0)
        self._calendar.pack(in_=self, expand=1, fill='both', side='bottom')
Ejemplo n.º 6
0
    def __init__(self, parent, name, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        self._name = name
        self.widgets = collections.OrderedDict()
        self.fig = plt.Figure()
        # Title bar
        self.vars = collections.OrderedDict()
        self.vars['ToHide'] = tk.BooleanVar(value=False)
        self.widgets['TitleBar'] = tk.Frame(self, bg='red')
        self.widgets['Title'] = ttk.Label(self.widgets['TitleBar'],
                                          text='Title')
        self.widgets['Hide'] = ttk.Checkbutton(self.widgets['TitleBar'],
                                               text='Hide',
                                               variable=self.vars['ToHide'],
                                               command=self._on_hide)
        # Track
        self.widgets['TrackFrame'] = tk.Frame(self, bg='green')
        fig_widget = FigureCanvasTkAgg(self.fig,
                                       master=self.widgets['TrackFrame'])
        self.widgets['Track'] = fig_widget.get_tk_widget()
        # Toolbar
        self.widgets['ToolFrame'] = tk.Frame(self, bg='purple')
        self.widgets['Toolbar'] = NavigationToolbar(fig_widget,
                                                    self.widgets['ToolFrame'])
        self.gridConfig = {
            'TitleBar': {
                'row': 0,
                'column': 0,
                'sticky': ui.FULL_EXPAND
            },
            'TrackFrame': {
                'row': 1,
                'column': 0,
                'sticky': ui.FULL_EXPAND
            },
            'ToolFrame': {
                'row': 2,
                'column': 0,
                'sticky': ui.FULL_EXPAND
            },
        }
        # Debug
        self.configure(bg='blue')

        # Handlers
        self.handlers = {'OnDraw': None}
Ejemplo n.º 7
0
def main():
    global root, textlabel
    root = Tk()
    textlabel = StringVar()
    textlabel.set(".docx => Whatsapp Converter")
    label = ttk.Label(root,
                      textvariable=textlabel,
                      foreground="red",
                      font=("Helvetica", 16))
    label.pack()
    Button(text='File Open', command=open_file).pack(fill=X)
    Button(text='Exit', command=quit).pack(fill=X)
    # Menu Bar
    menu = Menu(root)
    root.config(menu=menu)
    file = Menu(menu)
    file.add_command(label='Open', command=open_file)
    file.add_command(label='Exit', command=quit)
    menu.add_cascade(label='File', menu=file)
    root.iconbitmap(r'D:/Data/YGA/Workspace/DocxToWhatsapp/AdaboulMufrad.ico')
    root.mainloop()
Ejemplo n.º 8
0
    def _setup_widgets(self):
        s = """\
click on header to sort by that column
to change width of column drag boundary
        """
        msg = ttk.Label(wraplength="4i",
                        justify="left",
                        anchor="n",
                        padding=(10, 2, 10, 6),
                        text=s)
        msg.pack(fill='x')
        container = ttk.Frame()
        container.pack(fill='both', expand=True)
        # create a treeview with dual scrollbars
        self.tree = ttk.Treeview(columns=car_header, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.tree.yview)
        hsb = ttk.Scrollbar(orient="horizontal", command=self.tree.xview)
        self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
        self.tree.grid(column=0, row=0, sticky='nsew', in_=container)
        vsb.grid(column=1, row=0, sticky='ns', in_=container)
        hsb.grid(column=0, row=1, sticky='ew', in_=container)
        container.grid_columnconfigure(0, weight=1)
        container.grid_rowconfigure(0, weight=1)
Ejemplo n.º 9
0
def start():
    top.destroy()
    root.deiconify()
    root.attributes('-topmost', True)
    root.attributes('-topmost', False)

button = ttk.Button(top, text="OK", command=start)
button.pack(pady=5)
top.protocol('WM_DELETE_WINDOW', start)

method = tk.IntVar()
item = tk.IntVar()

methodlabel = ttk.Label(root,
                       text = "Select Decryption method",
                       justify = tk.LEFT,
                       padding = (20,0,0,0))

p = ttk.Radiobutton(root,
                   text = "Password",
                   variable = method,
                   value = 1)

pk = ttk.Radiobutton(root,
                    text = "Private Key",
                    variable = method,
                    value = 2)

password = ttk.Entry(root, show="*")

pkfilebox = ttk.Entry(root, state='disabled')
Ejemplo n.º 10
0
def blocklist():
    wblocklist = tk.Toplevel(gui)
    wblocklist.title("Edit block list")
    label1 = ttk.Label(wblocklist, text="App list")
    label1.pack()
    global applist
    applist = tk.Listbox(wblocklist)
    for app in apps:
        applist.insert(tk.END, app)
    applist.pack()

    def inserta():
        winput = tk.Toplevel(wblocklist)
        winput.title("Add program")
        entry = ttk.Entry(winput, width=10)
        entry.pack()

        def getinput():
            global applist
            applist.insert(tk.END, str(entry.get()))
            global apps
            apps.append(str(entry.get()))
            wsetting()
            winput.destroy()

        button = ttk.Button(winput, text="Add", command=getinput)
        button.pack()

    def removea():
        global applist
        removeline = applist.curselection()
        if removeline != ():
            # Not a empty tuple
            for line in removeline:
                applist.delete(line)
                global apps
                apps.pop(line)
        wsetting()

    insertab = ttk.Button(wblocklist, text="Insert", command=inserta)
    removeab = ttk.Button(wblocklist, text="Remove", command=removea)
    insertab.pack()
    removeab.pack()

    label2 = ttk.Label(wblocklist, text="Website list")
    label2.pack()
    global sitelist
    sitelist = tk.Listbox(wblocklist)
    for site in sites:
        sitelist.insert(tk.END, site)
    sitelist.pack()

    def insertb():
        winput = tk.Toplevel(wblocklist)
        winput.title("Add program")
        entry = ttk.Entry(winput, width=10)
        entry.pack()

        def getinput():
            global sitelist
            sitelist.insert(tk.END, str(entry.get()))
            global sites
            sites.append(str(entry.get()))
            wsetting()
            winput.destroy()

        button = ttk.Button(winput, text="Add", command=getinput)
        button.pack()

    def removeb():
        global sitelist
        removeline = sitelist.curselection()
        if removeline != ():
            # Not a empty tuple
            for line in removeline:
                sitelist.delete(line)
                global sites
                sites.pop(line)
        wsetting()

    insertbb = ttk.Button(wblocklist, text="Insert", command=insertb)
    removebb = ttk.Button(wblocklist, text="Remove", command=removeb)
    insertbb.pack()
    removebb.pack()
Ejemplo n.º 11
0
    def __init__(self, master):

        # formating window to have meaningful label and nice colours
        master.title('Silk Road Historic Feature Data Collection')
        master.configure(background = '#00000')

        # add in some window-universal styling
        self.style = ttk.Style()
        self.style.configure('TFrame', background = '#7387ed')
        self.style.configure('TButton', background = '#7387ed')
        self.style.configure('TLabelFrame', background = '#7387ed', font=('Arial', 12))
        self.style.configure('TLabel', background = '#7387ed', font = ('Arial', 11))
        self.style.configure('Header.TLabel', font = ('Arial', 18, 'bold'))

        # creating header frame and using pack geometry master to place at
        # top of window. This frame thanks user for contributing data.
        self.frame_header = ttk.Frame(master)
        self.frame_header.pack()

        ttk.Label(self.frame_header, text = "Thank you for sharing information about the Silk Road!",
         font = ('Arial', 14), background = '#7387ed').pack(pady=5)

        # creating a second frame in window - this time using the LabelFrame
        # constructor, so that the Location data being collected is made
        # distinct from other data types to avoid confusion about state (i.e.,
        # want location and not current status). Using pack geometry manager to
        # add frame under header.

        self.frame_loc = ttk.Labelframe(master, text="Location of Historic Feature")
        self.frame_loc.pack()

        # creating labels for each of the location inputs
        ttk.Label(self.frame_loc, text = "City:").grid(row = 0, column = 0, pady = 3, sticky = 'sw')
        ttk.Label(self.frame_loc, text = "State:").grid(row = 2, column = 0, pady = 3, sticky = 'sw')
        ttk.Label(self.frame_loc, text = "Country:").grid(row = 4, column = 0, pady = 3, sticky = 'sw')


        # creating Entry widgets for user input of location info
        self.entry_city = ttk.Entry(self.frame_loc, width = 50, font = ('Arial', 11))
        self.entry_state = ttk.Entry(self.frame_loc, width = 50, font = ('Arial', 11))
        self.entry_country = ttk.Entry(self.frame_loc, width = 50, font =('Arial', 11))

        # using grid geometry manager on entry widgets
        self.entry_city.grid(row = 1, column = 0)
        self.entry_state.grid(row = 3, column = 0)
        self.entry_country.grid(row = 5, column = 0)

        # creating another LabelFrame for Feature Detail section. Using pack
        # geometry mananger to add it under the Location frame.
        self.frame_details = ttk.Labelframe(master, text = "Feature Details")
        self.frame_details.pack()

        # creating Label widgets for each input
        ttk.Label(self.frame_details, text = "Name of Feature:").grid(row=0, column = 0, pady = 3, sticky = 'sw')
        ttk.Label(self.frame_details, text = "Type of Feature:").grid(row=2, column=0, pady = 3, sticky = 'sw')

        # creating widgets for feature details; name will be an Entry widget and
        # type will be a text widget to allow multi-line entry
        self.entry_name = ttk.Entry(self.frame_details, width = 60, font = ('Arial', 11))
        self.text_type = Text(self.frame_details, width = 60, height = 10, font = ('Arial', 11))

        # using grid geometry manager on feature detail widgets
        self.entry_name.grid(row = 1, column = 0)
        self.text_type.grid(row = 3, column = 0)


        # create buttons for Submit and Clear options. Submit sends data and
        # then the data is cleared from the fields ready for next entry. Clear
        # deletes all information from all fields.

        ttk.Button(self.frame_details, text = "Submit", command = self.submit).grid(row = 4, column = 0, pady=5)
        ttk.Button(self.frame_details, text = "Clear", command = self.clear).grid(row = 4, column = 1, pady=5)
Ejemplo n.º 12
0
def calculate(*args):
    try:
        value = float(feet.get())
        meters.set((0.3048 * value * 10000.0 + 0.5) / 10000.0)
    except ValueError:
        pass


root = Tk()
root.title("Feet to Meters")
mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
feet = StringVar()
meters = StringVar()
feet_entry = ttk.Entry(mainframe, width=7, textvariable=feet)
feet_entry.grid(column=2, row=1, sticky=(W, E))
ttk.Label(mainframe, textvariable=meters).grid(column=2, row=2, sticky=(W, E))
ttk.Button(mainframe, text="Calculate", command=calculate).grid(column=3,
                                                                row=3,
                                                                sticky=W)
ttk.Label(mainframe, text="feet").grid(column=3, row=1, sticky=W)
ttk.Label(mainframe, text="is equivalent to").grid(column=1, row=2, sticky=E)
ttk.Label(mainframe, text="meters").grid(column=3, row=2, sticky=W)
for child in mainframe.winfo_children():
    child.grid_configure(padx=5, pady=5)
feet_entry.focus()
root.bind('<Return>', calculate)
root.mainloop()
Ejemplo n.º 13
0
    def __init__(self, parent, title=None, video=''):
        Tk.Frame.__init__(self, parent)

        self.compDataset = []
        self.compComboOptions = ["Select Competition"]
        self.teamComboOptions = []
        self.teamComboOptionsI = []
        self.roundComboOptions = []
        self.videoWt = 120
        self.framesFound = 0
        self.isSplitting = 0

        style = ttk.Style()
        style.configure("TButton", padding=5, font=("Helvetica", "12"))
        style.configure("Player.TButton",
                        pady=0,
                        padx=0,
                        font=("Helvetica", "12"))
        style.configure("Split.TButton",
                        padx=5,
                        pady=20,
                        font=("Helvetica", "12"))
        style.configure("TProgressbar", pady=5)
        style.configure("SplitSelected.TButton",
                        padding=5,
                        background="green",
                        activebackground="yellow",
                        highlightbackground="yellow",
                        font=("Helvetica", "20"))
        style.configure("Error.SplitSelected.TButton",
                        padding=5,
                        background="red",
                        activebackground="red",
                        highlightbackground="red",
                        font=("Helvetica", "20"))
        self.parent = parent  # == root
        self.parent.title(title or "Skydive Or Bust Dubbing 1.0")
        self.video = expanduser(video)

        # first, top panel shows vide
        self.vWrapper = ttk.Frame(self.parent)
        self.videopanel = ttk.Frame(self.vWrapper)
        self.canvas = Tk.Canvas(self.videopanel)
        self.canvas.pack(fill=Tk.BOTH, expand=1)
        self.videopanel.pack(fill=Tk.BOTH, expand=1)
        self.vWrapper.pack(side=Tk.LEFT)
        # panel to hold buttons
        self.buttons_panel = Tk.Frame(self.vWrapper)
        self.splitting_panel = Tk.Frame(self.parent)

        compcombo = ttk.Frame(self.buttons_panel)
        self.compCombo = ttk.Combobox(compcombo, width=25)
        self.compCombo['values'] = self.compComboOptions

        self.teamCombo = ttk.Combobox(compcombo, width=25)
        self.roundCombo = ttk.Combobox(compcombo, width=25)
        self.compCombo.pack(side=Tk.TOP)
        self.teamCombo.pack(side=Tk.TOP)
        self.roundCombo.pack(side=Tk.TOP)
        compcombo.pack(side=Tk.BOTTOM, fill=Tk.X)

        self.compCombo.bind('<<ComboboxSelected>>',
                            lambda event: self.change_comp())

        buttons = ttk.Frame(self.buttons_panel)
        self.openButton = ttk.Button(buttons,
                                     text="Open",
                                     command=self.OnOpen,
                                     style="Player.TButton")
        self.playButton = ttk.Button(buttons,
                                     text="Play",
                                     command=self.OnPlay,
                                     style="Player.TButton")
        stop = ttk.Button(buttons,
                          text="Stop",
                          command=self.OnStop,
                          style="Player.TButton")
        eject = ttk.Button(buttons,
                           text="Eject",
                           command=self.OnEject,
                           style="Player.TButton")

        self.slateButton = ttk.Button(self.splitting_panel,
                                      text="Slate",
                                      command=self.onMarkSlate,
                                      style="Split.TButton")
        self.exitButton = ttk.Button(self.splitting_panel,
                                     text="Exit",
                                     command=self.onMarkExit,
                                     style="Split.TButton")
        self.uploadButton = ttk.Button(self.splitting_panel,
                                       text="Upload",
                                       command=self.onUpload,
                                       style="Split.TButton")

        self.statusLabelH = ttk.Label(self.splitting_panel,
                                      text="Video Status:")
        self.progressBar = ttk.Progressbar(self.splitting_panel,
                                           orient=Tk.HORIZONTAL,
                                           length=200,
                                           mode='determinate',
                                           style="TProgressbar")
        self.wtLabel = ttk.Label(self.splitting_panel,
                                 text=str(self.videoWt) + "sec Working Time")
        self.statusLabel = ttk.Label(self.splitting_panel, text="Open Video")

        self.openButton.pack(side=Tk.LEFT)
        self.playButton.pack(side=Tk.LEFT)
        stop.pack(side=Tk.LEFT)
        eject.pack(side=Tk.LEFT)
        self.slateButton.pack(side=Tk.TOP)
        self.exitButton.pack(side=Tk.TOP)
        self.uploadButton.pack(side=Tk.TOP)

        self.statusLabelH.pack(side=Tk.TOP)
        self.progressBar.pack(side=Tk.TOP)
        self.wtLabel.pack(side=Tk.TOP)
        self.statusLabel.pack(side=Tk.TOP)
        buttons.pack(side=Tk.BOTTOM, fill=Tk.X)

        # panel to hold player time slider
        timers = ttk.Frame(self.buttons_panel)
        self.timeVar = Tk.DoubleVar()
        self.timeSliderLast = 0
        self.timeSlider = Tk.Scale(timers,
                                   variable=self.timeVar,
                                   command=self.OnTime,
                                   from_=0,
                                   to=1000,
                                   orient=Tk.HORIZONTAL,
                                   length=400,
                                   showvalue=0)  # label='Time',
        self.timeSlider.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1)
        self.timeSliderUpdate = time.time()
        timers.pack(side=Tk.BOTTOM, fill=Tk.X)

        self.buttons_panel.pack(fill=Tk.BOTH, expand=1)
        self.splitting_panel.pack(fill=Tk.BOTH, expand=1)

        # VLC player
        args = []
        args.append('--no-xlib')
        self.Instance = vlc.Instance(args)
        self.player = self.Instance.media_player_new()
        self.player.audio_set_volume(0)

        self.parent.bind("<Configure>",
                         self.OnConfigure)  # catch window resize, etc.
        self.parent.update()

        # After parent.update() otherwise panel is ignored.
        # self.buttons_panel.overrideredirect(True)

        # Estetic, to keep our video panel at least as wide as our buttons panel.
        # self.parent.minsize(width=600, height=450)

        self.is_buttons_panel_anchor_active = False

        # Download API Data
        self.get_comps()
        self.list_comps()

        self.OnTick()  # set the timer up
Ejemplo n.º 14
0
    def CreateModelViewer(self, widgetholder):
        frame = ttk.Frame(self)
        inner_frame = ttk.Frame(frame,
                                borderwidth=5,
                                relief='sunken',
                                width=self.MinWidth,
                                height=self.MinHeight)

        top_frame = ttk.Frame(frame, borderwidth=5, relief='sunken')
        widgetholder.AddVariableLabel(top_frame, 'model_name')
        widgetholder.AddVariableLabel(top_frame, 'model_state')
        widgetholder.AddVariableLabel(top_frame, 'num_sector_eqn')
        widgetholder.AddVariableLabel(top_frame, 'num_final_eqn')
        widgetholder.AddButton(frame,
                               'back',
                               text='Back',
                               command=self.OnModelViewerBack)
        # widgetholder.AddListBox(frame, 'country', height=5, callback=self.OnChangeCountry)
        widgetholder.AddButton(frame,
                               'fullcodes',
                               'Generate\nFullCodes',
                               command=self.OnGenerateFullCodes)
        widgetholder.AddButton(frame,
                               'fixaliases',
                               'Fix Aliases',
                               command=self.OnFixAliases)
        widgetholder.AddButton(frame,
                               'generate_eqn',
                               'Generate\nEquations',
                               command=self.OnGenerateEquations)
        widgetholder.AddTree(frame,
                             'equations',
                             columns=('Equation', 'Comment'))
        # Push a configuration variable into the WidgetHolder
        widgetholder.Data['parameter_final_equation'] = 'Final Equations (All)'
        scrolly = ttk.Scrollbar(
            frame,
            orient=VERTICAL,
            command=self.WidgetsModelViewer.Widgets['equations'].yview)
        self.WidgetsModelViewer.Widgets['equations'][
            'yscrollcommand'] = scrolly.set
        label_name = ttk.Label(top_frame, text='Model Name: ')
        label_state = ttk.Label(top_frame, text="State: ")
        label_num_sector = ttk.Label(top_frame, text='# of Sector Equations')
        label_num_final = ttk.Label(top_frame, text='# of Final Equations')
        # Gridding
        frame.grid(row=0, column=0, sticky=('N', 'S', 'E', 'W'))
        # Top Grid
        top_frame.grid(row=0, column=0, columnspan=5, sticky=('W', ))
        label_name.grid(row=0, column=0)
        self.WidgetsModelViewer.Widgets['model_name'].grid(row=0,
                                                           column=1,
                                                           padx=5)
        label_state.grid(row=0, column=2, sticky=('E'))
        self.WidgetsModelViewer.Widgets['model_state'].grid(row=0,
                                                            column=3,
                                                            padx=5)
        label_num_sector.grid(row=1, column=0)
        self.WidgetsModelViewer.Widgets['num_sector_eqn'].grid(row=1,
                                                               column=1,
                                                               padx=5,
                                                               sticky=('W', ))
        label_num_final.grid(row=1, column=2)
        self.WidgetsModelViewer.Widgets['num_final_eqn'].grid(row=1,
                                                              column=3,
                                                              padx=5,
                                                              sticky=('W', ))
        self.WidgetsModelViewer.Widgets['back'].grid(row=0,
                                                     column=4,
                                                     sticky=('E'))
        self.WidgetsModelViewer.Widgets['equations'].grid(row=1,
                                                          column=0,
                                                          columnspan=5,
                                                          rowspan=5,
                                                          sticky=('N', 'S',
                                                                  'W', 'E'))
        scrolly.grid(row=1, column=6, rowspan=3, sticky=('N', 'S'))
        # self.WidgetsModelViewer.Widgets['fullcodes'].grid(row=1, column=4, sticky=('N', 'E'))
        # self.WidgetsModelViewer.Widgets['fixaliases'].grid(row=2, column=4, sticky=('N', 'E'))
        # self.WidgetsModelViewer.Widgets['generate_eqn'].grid(row=3, column=4, sticky=('N', 'E'))
        inner_frame.grid(row=0,
                         column=0,
                         rowspan=5,
                         columnspan=6,
                         sticky=('N', 'S', 'E', 'W'))
        #frame.columnconfigure(0, weight=1)
        #frame.columnconfigure(1, weight=1)
        #frame.columnconfigure(2, weight=1)
        #frame.columnconfigure(3, weight=1)
        frame.columnconfigure(4, weight=2)
        frame.rowconfigure(1, weight=1)
        frame.rowconfigure(2, weight=1)
        frame.rowconfigure(3, weight=1)
        run_frame = ttk.LabelFrame(frame, text='Run')
        run_frame.grid(row=0, column=7, rowspan=5, sticky=('N', 'S', 'E', 'W'))
        widgetholder.AddButton(run_frame,
                               'reload',
                               'Reload',
                               command=self.OnRunModel)
        label_next_step = ttk.Label(run_frame, text='Next Step:', width=25)
        widgetholder.AddButton(run_frame,
                               'run_next',
                               'Run Next Step',
                               command=self.OnRunNext)
        widgetholder.AddButton(run_frame,
                               'run_all',
                               'Run All Steps',
                               command=self.OnRunAll)
        widgetholder.AddVariableLabel(run_frame, 'next_step')
        label_choose_next = ttk.Label(run_frame, text='Possible Choices')
        widgetholder.AddListBox(run_frame,
                                'possible_steps',
                                height=7,
                                single_select=True,
                                callback=self.UpdateModelViewer)
        widgetholder.AddButton(run_frame,
                               'show_graph',
                               'Show Graph',
                               command=self.OnShowGraph)
        widgetholder.Widgets['reload'].grid(row=0, column=0)
        label_next_step.grid(row=1, column=0, pady=(10, 0))
        widgetholder.Widgets['next_step'].grid(row=2, column=0)
        widgetholder.Widgets['run_next'].grid(row=3, column=0)
        label_choose_next.grid(row=4, column=0)
        widgetholder.Widgets['possible_steps'].grid(row=5, column=0)
        widgetholder.Widgets['run_all'].grid(row=6, column=0, pady=20)

        widgetholder.Widgets['show_graph'].grid(row=7, column=0, pady=20)
        return frame
Ejemplo n.º 15
0
def popupmsg():
    global image, lab_5_data, lab_6_data, lab_7_data, error_flag_1, error_flag_2, error_flag_3, butter_width, butter_order, butter_a, popup_true

    butter_width = ""
    butter_order = ""
    butter_a = ""

    #fetch_details() fetches the user filled values in entry widgets once the user clicks 'ok' button
    def fetch_details():
        global image, lab_5_data, lab_6_data, lab_7_data, error_flag_1, error_flag_2, error_flag_3, butter_width, butter_order, butter_a, popup_true
        lab_5_data.set("")
        lab_6_data.set("")
        lab_7_data.set("")

        error_flag_1 = 0
        error_flag_2 = 0
        error_flag_3 = 0

        try:  #the below try-catch are used for validation of user input filled in the entry widgets
            butter_width = int(
                e1.get()
            )  #get() function is used to retrieve data filled in the entry widget
        except ValueError:  #ValueError occurs if the typecasting to int was not successful
            lab_5_data.set("Plese enter integer")
            error_flag_1 = 1
        try:
            butter_order = int(e2.get())
        except ValueError:
            lab_6_data.set("Plese enter integer")
            error_flag_2 = 1
        try:
            butter_a = float(e3.get())
            #dc_amplification value can lie between 0 an 1 inclusive only.
            if ((butter_a < 0) or (butter_a > 1)):
                lab_7_data.set("value between 0 and 1")
                error_flag_3 = 1
        except ValueError:
            lab_7_data.set("Plese enter float")
            error_flag_3 = 1
        #if there was erroneous input then destroy the popup and ask input again
        if ((error_flag_1 == 1) or (error_flag_2 == 1) or (error_flag_3 == 1)):
            popup.destroy()
            popupmsg()
        else:
            popup_true = 1  #no erroneous input from user
            var3.set(popup_true)

    popup = Tk.Tk()  #defining a popup window over my parent window
    popup.wm_title("Please enter details")

    #callback3() is used to destroy popup window and return control to main window
    def callback3(*args):
        if (popup_true == 1):
            popup.destroy()
            popup_return()

    ###
    #below portion defines the popup structure
    label1 = ttk.Label(popup, text="Width: ").grid(row=0)
    label2 = ttk.Label(popup, text="Order: ").grid(row=2)
    label3 = ttk.Label(popup, text="DC_amplification_factor(a): ").grid(row=4)

    e1 = ttk.Entry(popup)
    e2 = ttk.Entry(popup)
    e3 = ttk.Entry(popup)

    e1.grid(row=0, column=1)
    e2.grid(row=2, column=1)
    e3.grid(row=4, column=1)

    #if error_flag_x==0 then that entry x was not erroneous. thus retain the data filled in it.
    #user doesn't need to retype the data if he filled that entry correctly.
    if (error_flag_1 == 0):
        e1.insert(0, str(butter_width))  #insert(index, string)
    if (error_flag_2 == 0):
        e2.insert(0, str(butter_order))  #insert(index, string)
    if (error_flag_3 == 0):
        e3.insert(0, str(butter_a))  #insert(index, string)

    label4 = ttk.Label(popup, text="           ").grid(row=0, column=2)

    label5 = ttk.Label(popup, text=lab_5_data.get()).grid(row=1, column=1)
    label6 = ttk.Label(popup, text=lab_6_data.get()).grid(row=3, column=1)
    label7 = ttk.Label(popup, text=lab_7_data.get()).grid(row=5, column=1)

    B1 = ttk.Button(popup, text="Okay", command=fetch_details)
    B1.grid(row=6, column=1)
    ###
    var3 = Tk.StringVar()  #defining a callback for popup_true.
    #callback3() function will be called on each update of popup_true variable.
    var3.trace("w", callback3)

    popup.mainloop()
Ejemplo n.º 16
0
import datetime


def quit(*args):
    root.destroy()


def clock_time():
    time = datetime.datetime.now()
    time = (time.strftime("%H:%M:%S"))
    txt.set(time)
    root.after(1000, clock_time)


root = Tk()
root.attributes("=fullscreen", false)
root.configure(background='black')
root.bind("x", quit)
root.after(1000, clock_time)

fnt = font.Font(family='Helvetica', size=120, weight='bold')
txt = StringVar()
lbl = ttk.Label(root,
                textvariable=txt,
                font=fnt,
                foreground="white",
                background="black")
lbl.place(relx=0.5, rely=0.5, anchor=CENTER)

root.mainloop()
Ejemplo n.º 17
0


def checkN(n):
	try:
		n = int(n)
	except ValueError:
		try:
			messagebox.showerror("Error", "Sadece sayı girinizi")
		except:
			ttk.MessageBox.showerror("Error", "Sadece sayı giriniz")
		sys.exit(0)



label1 = ttk.Label(root,text='Ne kadar süre içinde kapatılsın', font=top_label_font)
label1.grid(row=0,column=0,pady=10,padx=10)

time_frame = ttk.Frame(root)
time_frame.grid(row=2,column=0,padx=10,pady=10)

hours = ttk.Entry(time_frame, font=time_font,width=entry_width) #
hours.insert(0, '00')
hours.grid(row=0,column=1)

label2 = ttk.Label(time_frame,text=':', font=time_font)
label2.grid(row=0,column=2)

minutes = ttk.Entry(time_frame, font=time_font,width=entry_width) #
minutes.insert(0, '00')
minutes.grid(row=0,column=3)
Ejemplo n.º 18
0
    def __init__(self, win):
        ttk.Frame.__init__(self, win)
        frame_left = ttk.Frame(self)
        frame_right1 = ttk.Frame(self)
        frame_right2 = ttk.Frame(self)
        win.title("车牌识别")
        win.state("zoomed")
        self.pack(fill=tk.BOTH, expand=tk.YES, padx="10", pady="10")
        frame_left.pack(side=LEFT, expand=1, fill=BOTH)
        frame_right1.pack(side=TOP, expand=1, fill=tk.Y)
        frame_right2.pack(side=RIGHT, expand=0)
        ttk.Label(frame_left, text='原图:').pack(anchor="nw")
        ttk.Label(frame_right1, text='形状定位车牌位置:').grid(column=0,
                                                       row=0,
                                                       sticky=tk.W)

        from_pic_ctl = ttk.Button(frame_right2,
                                  text="来自图片",
                                  width=20,
                                  command=self.from_pic)
        from_vedio_ctl = ttk.Button(frame_right2,
                                    text="来自摄像头",
                                    width=20,
                                    command=self.from_vedio)
        from_img_pre = ttk.Button(frame_right2,
                                  text="查看形状预处理图像",
                                  width=20,
                                  command=self.show_img_pre)
        self.image_ctl = ttk.Label(frame_left)
        self.image_ctl.pack(anchor="nw")

        self.roi_ctl = ttk.Label(frame_right1)
        self.roi_ctl.grid(column=0, row=1, sticky=tk.W)
        ttk.Label(frame_right1, text='形状定位识别结果:').grid(column=0,
                                                       row=2,
                                                       sticky=tk.W)
        self.r_ctl = ttk.Label(frame_right1, text="", font=('Times', '20'))
        self.r_ctl.grid(column=0, row=3, sticky=tk.W)
        self.color_ctl = ttk.Label(frame_right1, text="", width="20")
        self.color_ctl.grid(column=0, row=4, sticky=tk.W)
        from_vedio_ctl.pack(anchor="se", pady="5")
        from_pic_ctl.pack(anchor="se", pady="5")
        from_img_pre.pack(anchor="se", pady="5")

        ttk.Label(frame_right1, text='颜色定位车牌位置:').grid(column=0,
                                                       row=5,
                                                       sticky=tk.W)
        self.roi_ct2 = ttk.Label(frame_right1)
        self.roi_ct2.grid(column=0, row=6, sticky=tk.W)
        ttk.Label(frame_right1, text='颜色定位识别结果:').grid(column=0,
                                                       row=7,
                                                       sticky=tk.W)
        self.r_ct2 = ttk.Label(frame_right1, text="", font=('Times', '20'))
        self.r_ct2.grid(column=0, row=8, sticky=tk.W)
        self.color_ct2 = ttk.Label(frame_right1, text="", width="20")
        self.color_ct2.grid(column=0, row=9, sticky=tk.W)

        self.predictor = predict.CardPredictor()
        self.predictor.train_svm()
Ejemplo n.º 19
0
def add_label(window, text, column=0, row=0):
    label = ttk.Label(window, text=text)
    label.grid(column=column, row=row)
    return label
Ejemplo n.º 20
0
    def __init__(self, parent, title=None):
        Tk.Frame.__init__(self, parent)
        self.songURL = "EMPTY"
        self.songLabels = []  # list for names of songs
        self.webcamLbl = ttk.Label()  # webcam image widget label
        self.photoTaken = False
        self.webcam = cv2.VideoCapture(0)
        self.updateB = True  # bool to start and stop webcam update
        self.lastURL = "EMPTY"
        self.speed = 10  # milliseconds between UI refresh
        self.songs = []
        self.songCounter = 0
        self.parent = parent
        self.emotion = ""
        self.shutter = 0
        self.curated = True
        if title == None:
            title = "tk_vlc"
        self.parent.title(title)
        self.topMaster = ttk.Frame(self.parent)
        self.topPanel = ttk.Frame(self.topMaster)
        self.topPanelR = ttk.Frame(self.topMaster)
        #self.songName = ttk.Label(self.topPanel, text="Song: N/A")
        self.songName = ttk.Label(self.topPanel, text="Song: N/A")
        self.artistName = ttk.Label(self.topPanel, text="Artist: N/A")
        self.emotionLabel = ttk.Label(self.topPanel, text="Emotion: N/A")
        self.webCamButton = ttk.Button(self.topPanelR,
                                       text="Webcam Active",
                                       command=self.activateWebcam,
                                       width=15)

        self.shutter = ttk.Button(self.topPanelR,
                                  text="Take Photo",
                                  command=self.takethephoto,
                                  width=15)
        photostripButton = ttk.Button(self.topPanelR,
                                      text="Photostrip",
                                      command=self.browseFile,
                                      width=15)

        self.songName.grid(row=0, column=0, sticky=Tk.W)
        self.artistName.grid(row=1, column=0, sticky=Tk.W)
        self.emotionLabel.grid(row=2, column=0, sticky=Tk.W)
        photostripButton.grid(row=1, column=1, sticky=Tk.E)
        self.shutter.grid(row=0, column=0, rowspan=2, sticky=Tk.E, ipady=13)
        self.webCamButton.grid(row=0, column=1, sticky=Tk.E)
        self.topPanel.pack(fill=Tk.BOTH, side=Tk.LEFT)
        self.topPanelR.pack(fill=Tk.BOTH, side=Tk.RIGHT)
        self.topMaster.pack(fill=Tk.BOTH, side=Tk.TOP)

        # The second panel holds controls
        self.player = None
        self.videopanel = ttk.Frame(self.parent)
        image = im.open("artwork/default.jpg")
        photo = image
        imgtk = imTk.PhotoImage(image=image)

        self.webcamLbl = ttk.Label(self.videopanel, image=imgtk, text="Stream")
        self.webcamLbl.image = imgtk
        self.webcamLbl.pack(side=Tk.BOTTOM)
        self.videopanel.pack(fill=Tk.BOTH, expand=1)
        self.videopanel.pack_propagate(False)
        self.videopanel["width"] = 650
        self.videopanel["height"] = 500
        ctrlpanel = ttk.Frame(self.parent)
        pause = ttk.Button(ctrlpanel, text="Pause", command=self.OnPause)
        play = ttk.Button(ctrlpanel, text="Play", command=self.OnPlay)
        stop = ttk.Button(ctrlpanel, text="Stop", command=self.OnStop)
        volume = ttk.Label(ctrlpanel, text="Volume")

        self.nextButton = ttk.Button(ctrlpanel,
                                     text="Next",
                                     command=self.OnNext)
        self.prevButton = ttk.Button(ctrlpanel,
                                     text="Previous",
                                     command=self.OnPrev)

        self.prevButton.pack(side=Tk.LEFT)
        pause.pack(side=Tk.LEFT)
        play.pack(side=Tk.LEFT)
        stop.pack(side=Tk.LEFT)
        self.nextButton.pack(side=Tk.LEFT)
        self.nextButton["state"] = "disabled"
        self.prevButton["state"] = "disabled"
        volume.pack(side=Tk.LEFT)

        self.volume_var = Tk.IntVar()
        self.volslider = Tk.Scale(ctrlpanel,
                                  variable=self.volume_var,
                                  command=self.volume_sel,
                                  from_=0,
                                  to=100,
                                  orient=Tk.HORIZONTAL,
                                  length=100)
        self.volslider.pack(side=Tk.LEFT)
        self.volume_var.set(50)

        ctrlpanel.pack(side=Tk.BOTTOM)

        ctrlpanel2 = ttk.Frame(self.parent)
        self.scale_var = Tk.DoubleVar()
        self.timeslider_last_val = ""
        self.timeslider = Tk.Scale(ctrlpanel2,
                                   variable=self.scale_var,
                                   command=self.scale_sel,
                                   from_=0,
                                   to=1000,
                                   orient=Tk.HORIZONTAL,
                                   length=500)
        self.timeslider.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1)

        self.timeslider_last_update = time.time()
        ctrlpanel2.pack(side=Tk.BOTTOM, fill=Tk.X)

        ctrlpanel3 = ttk.Frame(self.parent)
        self.curated = Tk.IntVar()
        self.curateCheck = ttk.Checkbutton(ctrlpanel3,
                                           text="Curate",
                                           variable=self.curated)
        self.curated.set(1)
        self.curateCheck.pack(side=Tk.RIGHT)
        self.message = ttk.Label(ctrlpanel3,
                                 text="Status: Ready to take photo.")
        self.message.pack(side=Tk.LEFT)
        self.share = ttk.Button(ctrlpanel3, text="Share", command=self.share)
        self.share.pack(side=Tk.RIGHT)
        self.inputText = ttk.Entry(ctrlpanel3, width=15)
        self.inputText.pack(side=Tk.RIGHT)
        self.instruction = ttk.Label(ctrlpanel3, text="Your name: ")
        self.instruction.pack(side=Tk.RIGHT)

        ctrlpanel3.pack(fill=Tk.BOTH, side=Tk.TOP)

        # VLC player controls
        self.Instance = vlc.Instance()
        self.player = self.Instance.media_player_new()
        #self.player.audio_set_volume(100)
        self.timer = ttkTimer(self.OnTimer, 1.0)
        self.timer.start()
        self.parent.update()