Exemple #1
0
    def add_menu(self, label):
        """Add a menu.

        Parameters
        ----------
        label : string
            Menu label.
        """
        self._menus.append( tk_local.Menu(self._root, label) )
Exemple #2
0
    def _create_menu(self):
        """Utility function to setup main menu.

        Called by _create_ui.
        """

        # MAIN MENU ####################################################
        menu = tk.Menu(self.root)
        self.root.config(menu=menu)

        file_menu = tk.Menu(menu, tearoff=False)
        menu.add_cascade(label="File", underline='0', menu=file_menu)

        # FILE ##########################################################
        file_menu.add_command(label="New note",
                              underline=0,
                              command=self.cmd_root_new,
                              accelerator="Ctrl+N")
        self.root.bind_all("<Control-n>", self.cmd_root_new)

        file_menu.add_command(label="Delete note",
                              underline=0,
                              command=self.cmd_root_delete,
                              accelerator="Ctrl+D")
        self.root.bind_all("<Control-d>", self.cmd_root_delete)

        file_menu.add_separator()

        file_menu.add_command(label="Sync full",
                              underline=5,
                              command=self.cmd_sync_full)
        file_menu.add_command(label="Sync current note",
                              underline=0,
                              command=self.cmd_sync_current_note,
                              accelerator="Ctrl+S")
        self.root.bind_all("<Control-s>", self.cmd_sync_current_note)

        file_menu.add_separator()

        file_menu.add_command(label="Render Markdown to HTML",
                              underline=7,
                              command=self.cmd_markdown,
                              accelerator="Ctrl+M")
        self.root.bind_all("<Control-m>", self.cmd_markdown)

        self.continuous_rendering = tk.BooleanVar()
        self.continuous_rendering.set(False)
        file_menu.add_checkbutton(
            label="Continuous Markdown to HTML rendering",
            onvalue=True,
            offvalue=False,
            variable=self.continuous_rendering)

        file_menu.add_command(label="Render reST to HTML",
                              underline=7,
                              command=self.cmd_rest,
                              accelerator="Ctrl+R")
        self.root.bind_all("<Control-r>", self.cmd_rest)

        file_menu.add_separator()

        file_menu.add_command(label="Exit",
                              underline=1,
                              command=self.handler_close,
                              accelerator="Ctrl+Q")
        self.root.bind_all("<Control-q>", self.handler_close)

        # EDIT ##########################################################
        edit_menu = tk.Menu(menu, tearoff=False)
        menu.add_cascade(label="Edit", underline=0, menu=edit_menu)

        edit_menu.add_command(label="Undo",
                              accelerator="Ctrl+Z",
                              underline=0,
                              command=lambda: self.text_note.edit_undo())
        self.root.bind_all("<Control-z>", lambda e: self.text_note.edit_undo())

        edit_menu.add_command(label="Redo",
                              accelerator="Ctrl+Y",
                              underline=0,
                              command=lambda: self.text_note.edit_undo())
        self.root.bind_all("<Control-y>", lambda e: self.text_note.edit_redo())

        edit_menu.add_separator()

        edit_menu.add_command(label="Cut",
                              accelerator="Ctrl+X",
                              underline=2,
                              command=self.cmd_cut)
        edit_menu.add_command(label="Copy",
                              accelerator="Ctrl+C",
                              underline=0,
                              command=self.cmd_copy)
        edit_menu.add_command(label="Paste",
                              accelerator="Ctrl+V",
                              underline=0,
                              command=self.cmd_paste)

        edit_menu.add_command(label="Select All",
                              accelerator="Ctrl+A",
                              underline=7,
                              command=self.cmd_select_all)
        # FIXME: ctrl-a is usually bound to start-of-line. What's a
        # better binding for select all then?

        edit_menu.add_separator()

        edit_menu.add_command(label="Find",
                              accelerator="Ctrl+F",
                              underline=0,
                              command=lambda: self.search_entry.focus())
        self.root.bind_all("<Control-f>", lambda e: self.search_entry.focus())

        # TOOLS ########################################################
        tools_menu = tk.Menu(menu, tearoff=False)
        menu.add_cascade(label="Tools", underline=0, menu=tools_menu)

        tools_menu.add_command(label="Word Count",
                               underline=0,
                               command=self.word_count)

        # the internet thinks that multiple modifiers should work, but this didn't
        # want to.
        #self.root.bind_all("<Control-Shift-c>", lambda e: self.word_count())

        # HELP ##########################################################
        help_menu = tk.Menu(menu, tearoff=False)
        menu.add_cascade(label="Help", underline='0', menu=help_menu)

        help_menu.add_command(label="About",
                              underline=0,
                              command=self.cmd_help_about)
Exemple #3
0
def main():

    #GRAPHICAL USER INTERFACE"
    global root
    global source_img
    global im1
    global im
    #global numberCounterofAnImage
    #numberCounterofAnImage = 0
    global imageCounter
    imageCounter = 0
    global testFlag
    testFlag = 0

    root.geometry("800x600")
    root.title("CHARACTER RECOGNITION USING MOMENTS - ELİF PULUKÇU")

    root.menubar = tk.Menu(root, font="TkMenuFont")
    root.configure(menu=root.menubar)

    # GUI TAB DEFINITIONS #
    # TAB 1:
    tabControl = ttk.Notebook(root)
    root.tab1 = ttk.Frame(tabControl)
    tabControl.add(root.tab1, text=" TRAINING ")
    # TAB 2:
    root.tab2 = ttk.Frame(tabControl)
    tabControl.add(root.tab2, text=" TEST & RESULTS ")
    tabControl.pack(expand=1, fill="both")

    #TAB1: TRAINING PART GUI ELEMENTS #

    #labelFrame = LabelFrame(root.tab1, text="Select Your Training Image:")
    #labelFrame.grid(column=0, row=0, padx=8, pady=4)

    #label = Label(labelFrame, text="")
    #label.grid(column=0, row=0, sticky='W')

    #Browse & Open Button
    button1 = Button(root.tab1, text="Open Image")
    button1.grid(column=0, row=0, sticky='W')
    button1.place(relx=0.007, rely=0.1, height=54, width=92)
    button1.configure(background="#d9d9d9",
                      text="Browse & Open",
                      width=87,
                      command=lambda: openImage())

    #ALL IN ONE
    button5 = Button(root.tab1, text="START")
    button5.grid(column=0, row=0, sticky='W')
    button5.place(relx=0.143, rely=0.1, height=54, width=92)
    button5.configure(background="#FF0000",
                      text="START",
                      width=87,
                      command=lambda: imageProcess())

    #HU Moment Button
    button6 = Button(root.tab1, text="HU Moment")
    button6.grid(column=0, row=0, sticky='W')
    button6.place(relx=0.286, rely=0.1, height=54, width=92)
    button6.configure(background="#d9d9d9",
                      text="HU Moment",
                      width=87,
                      command=lambda: huMoment(a_bin))

    #R Moment Button
    button7 = Button(root.tab1, text="R Moment")
    button7.grid(column=0, row=0, sticky='W')
    button7.place(relx=0.429, rely=0.1, height=54, width=92)
    button7.configure(
        background="#d9d9d9",
        text="R Moment",
        width=87,
        command=lambda: rMoment(h_1, h_2, h_3, h_4, h_5, h_6, h_7))

    #Zernike Moment Button
    button8 = Button(root.tab1, text="Zernike Moment")
    button8.grid(column=0, row=0, sticky='W')
    button8.place(relx=0.572, rely=0.1, height=54, width=100)
    button8.configure(background="#d9d9d9", text="Zernike Moment", width=100)

    #E2E Training Button
    button9 = Button(root.tab1, text="Save to \nTraining Database")
    button9.grid(column=0, row=0, sticky='W')
    button9.place(relx=0.72, rely=0.1, height=54, width=120)
    button9.configure(background="#d9d9d9",
                      text="Save to \nTraining Database",
                      width=120,
                      command=lambda: SaveToTrainingDatabase())

    #Text box components such as vertical and horizontal scroll bars
    text.pack()
    text.insert(
        tk.END, "REPORT OF CHARACTER RECOGNITION USING MOMENTS - ELİF PULUKÇU")
    xscrollbar.config(command=text.xview)
    yscrollbar.config(command=text.yview)

    #TAB2: TESTING PART & RESULT PART BUTTONS#
    #Browse & Open Button
    button20 = Button(root.tab2, text="Open Image")
    button20.grid(column=0, row=0, sticky='W')
    button20.place(relx=0.007, rely=0.1, height=54, width=92)
    button20.configure(background="#d9d9d9",
                       text="Browse & Open",
                       width=87,
                       command=openImage)

    #Test an Image
    button21 = Button(root.tab2, text="Test The Image")
    button21.grid(column=0, row=0, sticky='W')
    button21.place(relx=0.133, rely=0.1, height=54, width=92)
    button21.configure(background="#FF0000",
                       text="Test an Image",
                       width=87,
                       command=lambda: testTheImage())

    #Compare the test Image results with Training database
    button23 = Button(
        root.tab2,
        text="Compare the Test Image Results with Training Database")
    button23.grid(column=0, row=0, sticky='W')
    button23.place(relx=0.256, rely=0.1, height=54, width=322)
    button23.configure(
        background="#d9d9d9",
        text="Compare the Test Image Results with Training Database",
        width=87,
        command=lambda: compare())

    root.mainloop()
Exemple #4
0
    def __init__(self, width=500, height=300):
        self.w = width
        self.h = height
        self.title = ' VIP视频破解助手'
        self.root = tk.Tk(className=self.title)
        self.url = tk.StringVar()
        self.v = tk.IntVar()
        self.v.set(1)

        #Frame空间
        frame_1 = tk.Frame(self.root)
        frame_2 = tk.Frame(self.root)
        frame_3 = tk.Frame(self.root)

        #Menu菜单
        menu = tk.Menu(self.root)
        self.root.config(menu=menu)
        filemenu = tk.Menu(menu, tearoff=0)
        moviemenu = tk.Menu(menu, tearoff=0)
        menu.add_cascade(label='菜单', menu=filemenu)
        menu.add_cascade(label='友情链接', menu=moviemenu)
        filemenu.add_command(
            label='使用说明',
            command=lambda: webbrowser.open(
                'http://blog.csdn.net/c406495762/article/details/71334633'))
        filemenu.add_command(
            label='关于作者',
            command=lambda: webbrowser.open('http://blog.csdn.net/c406495762'))
        filemenu.add_command(label='退出', command=self.root.quit)

        #各个网站链接
        moviemenu.add_command(
            label='网易公开课',
            command=lambda: webbrowser.open('http://open.163.com/'))
        moviemenu.add_command(
            label='腾讯视频', command=lambda: webbrowser.open('http://v.qq.com/'))
        moviemenu.add_command(
            label='搜狐视频',
            command=lambda: webbrowser.open('http://tv.sohu.com/'))
        moviemenu.add_command(
            label='芒果TV',
            command=lambda: webbrowser.open('http://www.mgtv.com/'))
        moviemenu.add_command(
            label='爱奇艺',
            command=lambda: webbrowser.open('http://www.iqiyi.com/'))
        moviemenu.add_command(
            label='PPTV',
            command=lambda: webbrowser.open('http://www.bilibili.com/'))
        moviemenu.add_command(
            label='优酷',
            command=lambda: webbrowser.open('http://www.youku.com/'))
        moviemenu.add_command(
            label='乐视', command=lambda: webbrowser.open('http://www.le.com/'))
        moviemenu.add_command(
            label='土豆',
            command=lambda: webbrowser.open('http://www.tudou.com/'))
        moviemenu.add_command(
            label='A站',
            command=lambda: webbrowser.open('http://www.acfun.tv/'))
        moviemenu.add_command(
            label='B站',
            command=lambda: webbrowser.open('http://www.bilibili.com/'))

        #控件内容设置
        group = tk.Label(frame_1, text='请选择一个视频播放通道:', padx=10, pady=10)
        tb1 = tk.Radiobutton(frame_1,
                             text='通道一',
                             variable=self.v,
                             value=1,
                             width=10,
                             height=3)
        tb2 = tk.Radiobutton(frame_1,
                             text='通道二',
                             variable=self.v,
                             value=2,
                             width=10,
                             height=3)
        label1 = tk.Label(frame_2, text="请输入视频链接:")
        entry = tk.Entry(frame_2,
                         textvariable=self.url,
                         highlightcolor='Fuchsia',
                         highlightthickness=1,
                         width=35)
        label2 = tk.Label(frame_2, text=" ")
        play = tk.Button(frame_2,
                         text="播放",
                         font=('楷体', 12),
                         fg='Purple',
                         width=2,
                         height=1,
                         command=self.video_play)
        label3 = tk.Label(frame_2, text=" ")
        # download = tk.Button(frame_2, text = "下载", font = ('楷体',12), fg = 'Purple', width = 2, height = 1, command = self.download_wmxz)
        QR_Code = tk.Button(frame_3,
                            text="手机观看",
                            font=('楷体', 12),
                            fg='Purple',
                            width=10,
                            height=2,
                            command=self.QR_Code)
        label_explain = tk.Label(
            frame_3,
            fg='red',
            font=('楷体', 12),
            text='\n注意:支持大部分主流视频网站的视频播放!\n此软件仅用于交流学习,请勿用于任何商业用途!')
        label_warning = tk.Label(frame_3,
                                 fg='blue',
                                 font=('楷体', 12),
                                 text='\n建议:将Chrome内核浏览器设置为默认浏览器\n作者:Jack_Cui')

        #控件布局
        frame_1.pack()
        frame_2.pack()
        frame_3.pack()
        group.grid(row=0, column=0)
        tb1.grid(row=0, column=1)
        tb2.grid(row=0, column=2)
        label1.grid(row=0, column=0)
        entry.grid(row=0, column=1)
        label2.grid(row=0, column=2)
        play.grid(row=0, column=3, ipadx=10, ipady=10)
        label3.grid(row=0, column=4)
        # download.grid(row = 0, column = 5,ipadx = 10, ipady = 10)
        QR_Code.grid(row=0, column=0)
        label_explain.grid(row=1, column=0)
        label_warning.grid(row=2, column=0)