Exemplo n.º 1
0
def main():
    """
    Begins the program and starts up the login window
    Calls the necessary functions to create the window and
    Binds controls and buttons in order to et to the next window
    """
    login_root = tk.Tk()
    login_root.wm_title("Login to Server")
    url = tk.Label(login_root, text="URL: ")
    username = tk.Label(login_root, text="Username: "******"Password: "******"IP (XX-XX-XXX-XXX): ")
    entry_url = tk.Entry(login_root, width=30)
    entry_ip = tk.Entry(login_root, width=30)
    entry_user = tk.Entry(login_root, width=30)
    entry_pass = tk.Entry(login_root, show="*", width=30)
    url.grid(row=0, sticky=tk.E)
    ip.grid(row=1, sticky=tk.E)
    username.grid(row=2, sticky=tk.E)
    password.grid(row=3, sticky=tk.E)
    entry_url.grid(row=0, column=1, sticky=tk.E)
    entry_ip.grid(row=1, column=1, sticky=tk.E)
    entry_user.grid(row=2, column=1, sticky=tk.E)
    entry_pass.grid(row=3, column=1, sticky=tk.E)
    global attempts
    login_root.bind(
        "<Return>",
        lambda x: checkcreds(login_root, entry_url.get(), entry_user.get(),
                             entry_pass.get(), entry_ip.get()))
    submit = tk.Button(login_root,
                       text="Login",
                       command=lambda: checkcreds(login_root, entry_url.get(
                       ), entry_user.get(), entry_pass.get(), entry_ip.get()))
    submit.grid(row=4, columnspan=2)
    login_root.mainloop()
Exemplo n.º 2
0
    def createPage(self):
        self.loginBox = mtk.LabelFrame(self.loginPage, text="账号登录", fg="blue")
        self.loginBox.place(x=30, y=30, width=300, height=280)

        self.userName = mtk.Label(self.loginBox, text="账号:")
        self.userName.place(x=20, y=20, width=50, height=30)
        self.userNameText = mtk.Entry(self.loginBox)
        self.userNameText.place(x=90, y=20, width=150, height=30)

        self.passWord = mtk.Label(self.loginBox, text="密码:")
        self.passWord.place(x=20, y=70, width=50, height=30)
        self.passWordText = mtk.Entry(self.loginBox)
        self.passWordText.place(x=90, y=70, width=150, height=30)

        # self.keyValue = mtk.Label(self.loginBox, text="KEY:")
        # self.keyValue.place(x=20, y=120, width=50, height=30)
        self.keyValueText = mtk.Entry(self.loginBox, show="*")
        self.keyValueText.place(x=90, y=120, width=150, height=30)

        self.loginBtn = mtk.Button(self.loginBox,
                                   text="登录",
                                   command=lambda: self.thread_it(self.login))
        self.loginBtn.place(x=150, y=180, width=80, height=30)

        self.logoutBtn = mtk.Button(self.loginBox,
                                    text="退出",
                                    command=lambda: self.thread_it(self.stop))
        self.logoutBtn.place(x=40, y=180, width=80, height=30)
Exemplo n.º 3
0
    def createPage(self):
        self.login = mtk.LabelFrame(self.root, text="登录", fg="blue")
        self.login.place(x=30, y=50, width=380, height=250)

        self.label_asino = mtk.Label(self.login, text="AsiNumber:")
        self.label_asino.place(x=30, y=10, width=75, height=25)
        self.entry_asino = mtk.Entry(self.login)
        self.entry_asino.place(x=120, y=10, width=220, height=25)

        self.label_user = mtk.Label(self.login, text="账号:")
        self.label_user.place(x=30, y=65, width=75, height=25)
        self.entry_user = mtk.Entry(self.login)
        self.entry_user.place(x=120, y=65, width=220, height=25)

        self.label_passwd = mtk.Label(self.login, text="密码:")
        self.label_passwd.place(x=30, y=120, width=75, height=25)
        self.entry_passwd = mtk.Entry(self.login, show="*")
        self.entry_passwd.place(x=120, y=120, width=220, height=25)

        self.btn_logins = mtk.Button(
            self.login,
            text="自动登录",
            command=lambda: self.thread_it(self.loginSelf))
        self.btn_logins.place(x=40, y=170, width=100, height=30)

        self.btn_login = mtk.Button(
            self.login,
            text="登录",
            command=lambda: self.thread_it(self.loginContent))
        self.btn_login.place(x=220, y=170, width=100, height=30)
Exemplo n.º 4
0
    def __creatUI(self):
        self.box = mtk.LabelFrame(self.root)
        self.box.place(x=20, y=20, width=340, height=400)

        self.user_name = mtk.Label(self.box, text="账  号:")
        self.user_name.place(x=20, y=20, width=60, height=25)
        self.user_name_text = mtk.Entry(self.box)
        self.user_name_text.place(x=80, y=20, width=100, height=25)

        self.pass_word = mtk.Label(self.box, text="密  码:")
        self.pass_word.place(x=20, y=70, width=60, height=25)
        self.password_text = mtk.Entry(self.box)
        self.password_text.place(x=80, y=70, width=100, height=25)

        self.loginadd = mtk.Label(self.box, text="登录地:")
        self.loginadd.place(x=20, y=120, width=60, height=25)
        self.loginaddsel = ttk.Combobox(self.box)
        self.loginaddsel["values"] = [
            "上海总部", "上海物流", "甘肃", "河北", "西北", "山西", "浙江", "安徽", "山东", "江西",
            "武汉", "北京", "江苏", "四川", "广东"
        ]
        self.loginaddsel.place(x=80, y=120, width=100, height=25)

        self.verify_code = mtk.Label(self.box, text="验证码:")
        self.verify_code.place(x=20, y=170, width=60, height=25)
        self.verify_code_text = mtk.Entry(self.box)
        self.verify_code_text.place(x=80, y=170, width=100, height=25)

        self.exam_name = mtk.Label(self.box, text="考试名称:")
        self.exam_name.place(x=20, y=220, width=60, height=25)
        self.exam_name_text = mtk.Entry(self.box)
        self.exam_name_text.place(x=80, y=220, width=100, height=25)

        self.loadbtn = mtk.Button(
            self.box,
            text="加载题型",
            command=lambda: self.thread_it(self.__loadExcel))
        self.loadbtn.place(x=210, y=20, width=100, height=50)

        self.startbtn = mtk.Button(self.box,
                                   text="开始",
                                   command=lambda: self.thread_it(self.start))
        self.startbtn.place(x=210, y=100, width=100, height=50)

        self.stopbtn = mtk.Button(self.box,
                                  text="退出",
                                  command=lambda: self.thread_it(self.stop))
        self.stopbtn.place(x=210, y=180, width=100, height=50)

        self.logs = mtk.LabelFrame(self.box, text="信息", fg="blue")
        self.logs.place(x=20, y=270, width=300, height=120)
        self.logtext = scrolledtext.ScrolledText(self.logs, fg="green")
        self.logtext.place(x=20, y=10, width=270, height=80)
Exemplo n.º 5
0
 def replace_user_with_guess(self, event):
     self.user_entry["state"] = "disabled"
     self.guess = tk.StringVar()
     self.guess.set("Who's This Pokemon?")
     self.guess_box = tk.Entry(self, textvariable=self.guess)
     self.guess_box.pack(side="bottom")
     self.guess_box.bind("<Key-Return>", self.update_score)
     self.guess_box.bind("<Key-Return>", self.show_guess_with_answer, "+")
     self.guess_box.bind("<Key-Return>", self.create_next_button, "+")
Exemplo n.º 6
0
	def makeView(self, master):
		frame = mtk.Frame(master, **self.configArgs)
		bg = frame.cget('bg')
		l = mtk.Label(frame, width=15, text=self.label, bg=bg, anchor="w")
		v = mtk.StringVar(frame, value=self.defaultEntry)
		self.ent = mtk.Entry(frame, textvariable=v)
		self.ent.bind("<Return>", self.enter)
		l.pack(side=mtk.LEFT, padx=5)
		self.ent.pack(side=mtk.LEFT, expand=True, fill=mtk.X)
		frame.pack(fill=mtk.X, pady=5, anchor="w")
		return frame
Exemplo n.º 7
0
 def __init__(self):
     self.showTagWin = tk.Tk()
     self.showTagWin.title('查找tag')
     self.showTagWin.geometry('300x200')
     self.showTagWin.protocol("WM_DELETE_WINDOW", self.showTagWin.quit())
     self.tag_input_lb = tk.Label(master=self.showTagWin, text='请输入tag:')
     self.tag_input_lb.pack(side=tk.LEFT, padx=5, pady=20)
     self.tag_input_txt = tk.Entry(master=self.showTagWin)
     self.tag_input_txt.pack(side=tk.LEFT, padx=5, pady=20)
     self.show_bt = tk.Button(master=self.showTagWin, text='显示', command=self.find)
     self.show_bt.pack(side=tk.LEFT, padx=10, pady=50)
     self.showTagWin.mainloop()
Exemplo n.º 8
0
    def create_root(self):
        """
        Description
        -----------
        Sets up all the parameters for the gui (text, buttons, entry boxes, etc.)

        Returns
        -------
        None
        """
        self.root = tk.Tk()
        self.root.title('Ultra Deluxe Focus Control Hub EXTREME')
        self.root.geometry('430x140')

        connection_text = tk.Label(self.root,
                                   text='The focuser is connected to: ')
        connection_text.grid(row=1, column=1)
        self.comport_var = tk.StringVar()
        self.comport_var.set(self.focuser.comport)
        self.comport = tk.Label(self.root, textvariable=self.comport_var)
        self.comport.grid(row=1, column=2)

        self.position = tk.IntVar()
        self.position.set(self.focuser.position)
        position_msg = tk.Label(self.root, text='The current position is: ')
        position_msg.grid(row=2, column=1)
        self.position_text = tk.Label(self.root, textvariable=self.position)
        self.position_text.grid(row=2, column=2)

        self.delta = tk.IntVar()
        self.delta.set(config_reader.get_config().initial_focus_delta)
        delta_entry = tk.Entry(self.root, textvariable=self.delta, width=5)
        delta_entry.grid(row=3, column=2)
        button_frame = tk.Frame(self.root)
        self.move_in = tk.Button(
            button_frame,
            text='MOVE IN',
            state=tk.DISABLED,
            command=lambda: self.move_in_cmd(self.delta.get()))
        self.move_out = tk.Button(
            button_frame,
            text='MOVE OUT',
            state=tk.DISABLED,
            command=lambda: self.move_out_cmd(self.delta.get()))
        button_frame.grid(row=3, column=1, sticky="nsew", pady=10, padx=20)
        self.move_in.pack(side="left")
        self.move_out.pack(side="right")
        abort = tk.Button(self.root,
                          text='ABORT',
                          command=self.abort_cmd,
                          width=15)
        abort.grid(row=4, column=1, columnspan=2)
Exemplo n.º 9
0
    def __creatUI(self):
        self.box = mtk.LabelFrame(self.root)
        self.box.place(x=20, y=20, width=340, height=400)

        self.user_name = mtk.Label(self.box, text="账  号:")
        self.user_name.place(x=20, y=20, width=60, height=25)
        self.user_name_text = mtk.Entry(self.box)
        self.user_name_text.place(x=80, y=20, width=100, height=25)

        self.pass_word = mtk.Label(self.box, text="密  码:")
        self.pass_word.place(x=20, y=70, width=60, height=25)
        self.password_text = mtk.Entry(self.box)
        self.password_text.place(x=80, y=70, width=100, height=25)

        self.verify_code = mtk.Label(self.box, text="验证码:")
        self.verify_code.place(x=20, y=120, width=60, height=25)
        self.verify_code_text = mtk.Entry(self.box)
        self.verify_code_text.place(x=80, y=120, width=100, height=25)

        self.exam_name = mtk.Label(self.box, text="考试名称:")
        self.exam_name.place(x=20, y=170, width=60, height=25)
        self.exam_name_text = mtk.Entry(self.box)
        self.exam_name_text.place(x=80, y=170, width=100, height=25)

        self.loadbtn = mtk.Button(self.box, text="加载题型", command=lambda: self.thread_it(self.__loadExcel))
        self.loadbtn.place(x=210, y=20, width=100, height=50)

        self.startbtn = mtk.Button(self.box, text="开始", command=lambda: self.thread_it(self.start))
        self.startbtn.place(x=210, y=85, width=100, height=50)

        self.stopbtn = mtk.Button(self.box, text="退出", command=lambda: self.thread_it(self.stop))
        self.stopbtn.place(x=210, y=150, width=100, height=50)

        self.logs = mtk.LabelFrame(self.box, text="信息", fg="blue")
        self.logs.place(x=20, y=210, width=300, height=170)
        self.logtext = scrolledtext.ScrolledText(self.logs, fg="green")
        self.logtext.place(x=20, y=10, width=270, height=130)
Exemplo n.º 10
0
    def create_widgets(self):
        self.username = tk.StringVar()
        self.username.set("Enter Your Username Here")
        self.user_entry = tk.Entry(self, textvariable=self.username)
        self.user_entry.pack(side="top")
        self.user_entry.bind('<Key-Return>', self.create_user)
        self.user_entry.bind('<Key-Return>', self.pick_pokemon_with_image, '+')
        self.user_entry.bind('<Key-Return>', self.display_image, '+')
        self.user_entry.bind('<Key-Return>', self.replace_user_with_guess, '+')

        self.quit_button = tk.Button(self,
                                     text="QUIT",
                                     fg="red",
                                     command=self.quit)
        self.quit_button.pack(side="bottom")
Exemplo n.º 11
0
    def createPage(self):
        self.infoBox = mtk.LabelFrame(self.root, text="搜索框", fg="blue")
        self.infoBox.place(x=20, y=20, width=540, height=100)

        self.kw = mtk.Label(self.infoBox, text="关键词:")
        self.kw.place(x=20, y=20, width=50, height=25)
        self.kwText = mtk.Entry(self.infoBox)
        self.kwText.place(x=80, y=20, width=150, height=25)

        self.searchTime = mtk.Label(self.infoBox, text="搜索时间:")
        self.searchTime.place(x=280, y=20, width=60, height=25)
        self.stText = ttk.Combobox(self.infoBox)
        self.stText.place(x=350, y=20, width=100, height=25)
        self.stText["values"] = [
            "7 Days", "14 Days", "30 Days", "45 Days", "60 Days", "90 Days",
            "1 Year"
        ]

        self.log = mtk.LabelFrame(self.root, text="log日志", fg="blue")
        self.log.place(x=20, y=140, width=300, height=350)
        self.logtext = scrolledtext.ScrolledText(self.log, fg="green")
        self.logtext.place(x=20, y=15, width=270, height=300)

        self.status = mtk.LabelFrame(self.root, text="当前进度", fg="blue")
        self.status.place(x=340, y=140, width=220, height=150)

        self.indexnow = mtk.Label(self.status, text="当前条数:")
        self.indexnow.place(x=20, y=20, width=60, height=25)
        self.indexnowText = mtk.Label(self.status, text="0 条")
        self.indexnowText.place(x=90, y=20, width=50, height=25)

        self.indexTotals = mtk.Label(self.status, text="总条数:")
        self.indexTotals.place(x=20, y=65, width=60, height=25)
        self.indexTotalsText = mtk.Label(self.status, text="0 条")
        self.indexTotalsText.place(x=90, y=65, width=50, height=25)

        self.btnBox = mtk.LabelFrame(self.root)
        self.btnBox.place(x=340, y=320, width=220, height=170)

        self.startbtn = mtk.Button(self.btnBox,
                                   text="开始",
                                   command=lambda: self.thread_it(self.start))
        self.startbtn.place(x=40, y=20, width=120, height=40)
        self.loadoutbtn = mtk.Button(
            self.btnBox,
            text="导出",
            command=lambda: self.thread_it(self.export))
        self.loadoutbtn.place(x=40, y=100, width=120, height=40)
Exemplo n.º 12
0
def createwindow(root):
    """
    Creates the gui window with all of its properties including,
    the menus, the scrollbar, the entrybox, and the display window
    :param root: The mainframe of the window
    """
    global lb
    global textbox
    # Menus
    dropDown = tk.Menu(root)
    root.config(menu=dropDown)
    actions = tk.Menu(dropDown)
    dropDown.add_cascade(label="Actions", menu=actions)
    actions.add_command(label='Device Info', command=deviceinfo)
    actions.add_command(label='Clear Devices', command=cleardevices)
    actions.add_command(label='Clear', command=clearall)
    actions.add_command(label='Clear log', command=clearlog)
    actions.add_command(label='Help', command=helpaction)
    actions.add_command(label='Geolocation', command=geolocation)
    # actions.add_command(label='Quit', command=root.destroy())
    lb = tk.Listbox(root, selectmode=tk.SINGLE)
    collecteddevices()
    lb.pack(side=tk.LEFT, fill=tk.Y)
    lb.bind('<ButtonRelease-1>', getlist)
    # Entrybox
    entry_cmd = tk.Entry(root, width=100)
    entry_cmd.pack(side=tk.BOTTOM)
    label_cmd = tk.Label(root, text="Command:")
    label_cmd.pack(side=tk.BOTTOM)
    entry_cmd.delete(0, tk.END)
    root.bind("<Return>", lambda x: changeinfo(entry_cmd.get(), entry_cmd))
    # Scrollbar
    scroll = tk.Scrollbar(root)
    textbox = tk.Text(root, height=40, width=125)
    scroll.pack(side=tk.RIGHT, fill=tk.Y)
    textbox.pack(side=tk.TOP, fill=tk.Y)
    scroll.config(command=textbox.yview)
    textbox.config(yscrollcommand=scroll.set)
Exemplo n.º 13
0
    def creatUI(self):
        self.window = tk.Tk()
        self.window.title("GDMapPoi")
        # 设置窗口大小和位置
        self.window.geometry('960x640+500+50')

        # poi搜索
        # self.oneSearch = tk.Label(self.window, text="Poi搜索", font=self.font)
        # self.oneSearch.place(x=20, y=50)
        # 高德API接口KEY
        self.label_api_key = tk.Label(self.window,
                                      text="高德API接口KEY",
                                      font=("思源黑体", 11, "bold"))
        self.label_api_key.place(x=20, y=20, width=120, height=25)
        self.entry_api_key = tk.Entry(self.window, font=("思源黑体", 11))
        # self.entry_api_key["values"] = ("b9cb3ad7476d6d6b977340ebdae2f976")
        self.entry_api_key.place(x=20, y=50, width=450, height=25)

        # 数据量
        self.label_totals = tk.Label(self.window,
                                     text="数据量",
                                     font=("思源黑体", 11, "bold"))
        self.label_totals.place(x=495, y=50, width=50, height=25)
        self.entry_totals = tk.Entry(self.window, font=("思源黑体", 11))
        self.entry_totals.place(x=555, y=50, width=100, height=25)

        # 地 区
        self.label_cities = tk.Label(self.window,
                                     text="地 区",
                                     font=("思源黑体", 11, "bold"))
        self.label_cities.place(x=740, y=20, width=50, height=25)
        self.entry_cities = scrolledtext.ScrolledText(self.window,
                                                      font=("思源黑体", 11))
        self.entry_cities.place(x=740, y=50, width=170, height=195)

        # 关键词
        self.label_keywords = tk.Label(self.window,
                                       text="关键词",
                                       font=("思源黑体", 11, "bold"))
        self.label_keywords.place(x=740, y=245, width=50, height=25)
        self.entry_keywords = scrolledtext.ScrolledText(self.window,
                                                        font=("思源黑体", 11))
        self.entry_keywords.place(x=740, y=275, width=170, height=195)

        # 查询button
        self.btn_seacch = tk.Button(
            self.window,
            text="查询",
            font=("思源黑体", 11, "bold"),
            command=lambda: self.thread_it(self.start_task))
        self.btn_seacch.place(x=740, y=510, width=150, height=30)

        # 导出excel
        self.btn_excel = tk.Button(
            self.window,
            text="导出Excel",
            font=("思源黑体", 11, "bold"),
            command=lambda: self.thread_it(self.save2excel))
        self.btn_excel.place(x=740, y=550, width=150, height=30)

        # 数据展示
        title = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
        self.box = ttk.Treeview(self.window, columns=title, show='headings')
        # style = ttk.Style()
        # style.configure("Treeview.Heading", font=("思源黑体", 11, "bold"))
        self.box.place(x=20, y=100, width=700, height=505)
        self.box.column('1', width=50, anchor='center')
        self.box.column('2', width=50, anchor='center')
        self.box.column('3', width=50, anchor='center')
        self.box.column('4', width=150, anchor='center')
        self.box.column('5', width=150, anchor='center')
        self.box.column('6', width=150, anchor='center')
        self.box.column('7', width=100, anchor='center')
        self.box.column('8', width=80, anchor='center')
        self.box.column('9', width=80, anchor='center')
        self.box.heading('1', text='省份')
        self.box.heading('2', text='城市')
        self.box.heading('3', text='区域')
        self.box.heading('4', text='名称')
        self.box.heading('5', text='标签')
        self.box.heading('6', text='地址')
        self.box.heading('7', text='电话')
        self.box.heading('8', text='经度')
        self.box.heading('9', text='纬度')

        self.VScroll1 = Scrollbar(self.box,
                                  orient='vertical',
                                  command=self.box.yview)
        self.VScroll1.pack(side="right", fill="y")
        self.VScroll2 = Scrollbar(self.box,
                                  orient='horizontal',
                                  command=self.box.xview)
        self.VScroll2.pack(side="bottom", fill="x")
        # self.VScroll2.place(relx=0.971, rely=0.028, relwidth=0.024, relheight=0.958)
        # self.VScroll1.place(relx=0.971, rely=0.028, relwidth=0.024, relheight=0.958)
        # 给treeview添加配置
        self.box.configure(yscrollcommand=self.VScroll1.set)
        self.box.configure(xscrollcommand=self.VScroll2.set)
Exemplo n.º 14
0
    def __init__(self, inputDict=None, debug=False):
        self.inputDict = inputDict
        self.debug = debug

        self.rxd = []
        self.txd = []

        self.window = tk.Tk()
        self.window.title(window_title)
        self.window.geometry(window_size)

        self.right_frame = tk.Frame(self.window, width=450, height=100)
        self.left_frame = tk.Frame(self.window, width=250, height=100)
        self.corner_frame = tk.Frame(self.window, width=100, height=20)
        self.extra_frame = tk.Frame(self.window, width=30, height=100)
        self.window.grid_columnconfigure(1, weight=1)
        self.right_frame.grid(row=0, column=1)
        self.left_frame.grid(row=0, column=0, sticky="nsew")
        self.corner_frame.grid(row=1, column=0, sticky="sw")
        self.extra_frame.grid(row=0, column=2)

        # textbot for rx
        self.rx_box_scrollbar = tk.Scrollbar(self.left_frame)
        self.rx_box_text = tk.Text(self.left_frame,
                                   height=rx_textbox_height,
                                   width=rx_textbox_width)
        self.rx_box_scrollbar.grid(column=1, row=0, sticky=tk.N + tk.S + tk.W)
        self.rx_box_text.grid(column=0, row=0)
        self.rx_box_scrollbar.config(command=self.rx_box_text.yview)
        self.rx_box_text.config(yscrollcommand=self.rx_box_scrollbar.set)

        # rx button
        self.receive_start_button = tk.Button(self.right_frame,
                                              text="Start RX",
                                              command=self.receive)
        self.receive_start_button.grid(column=0, row=0, pady=5)

        # clear rx box windows button
        self.clear_button = tk.Button(self.right_frame,
                                      text="Clear",
                                      command=self.clear)
        self.clear_button.grid(column=0, row=1, pady=5)

        # tx button
        self.transmit_start_button = tk.Button(self.corner_frame,
                                               text="Start TX",
                                               command=self.transmit)
        self.transmit_start_button.grid(column=2, row=0)

        # tx message
        self.tx_msg = tk.Entry(self.corner_frame, width=tx_msg_width)
        self.tx_msg.grid(column=1, row=0)

        # tx label
        self.txlbl = tk.Label(self.corner_frame, text="TX Message:")
        self.txlbl.grid(column=0, row=0)

        # rx channel button
        self.rx_channel_button = tk.Button(self.right_frame,
                                           text="Set RX channel",
                                           command=self.setRXchannel)
        self.rx_channel_button.grid(column=1, row=3, pady=5)

        # rx channel
        self.rx_channel = tk.Entry(self.right_frame, width=10)
        self.rx_channel.grid(column=1, row=4, pady=5)

        # tx channel button
        self.tx_channel_button = tk.Button(self.right_frame,
                                           text="Set TX channel",
                                           command=self.setTXchannel)
        self.tx_channel_button.grid(column=0, row=3, pady=5)

        # tx channel
        self.tx_channel = tk.Entry(self.right_frame, width=10)
        self.tx_channel.grid(column=0, row=4, pady=5)

        # reset button
        self.reset_button = tk.Button(self.right_frame,
                                      text="Reset Device",
                                      command=self.reset)
        self.reset_button.grid(column=0, row=2, pady=5)

        # opMode droplist and button
        OPTIONS = [
            "NORMAL_MODE", "SLEEP_MODE", "INTERNAL_LOOPBACK_MODE",
            "LISTEN_ONLY_MODE", "CONFIGURATION_MODE", "EXTERNAL_LOOPBACK_MODE",
            "CLASSIC_MODE", "RESTRICTED_MODE", "INVALID_MODE"
        ]

        self.droplist = tk.StringVar(self.left_frame)
        self.droplist.set(OPTIONS[0])  # default value

        w = tk.OptionMenu(self.right_frame, self.droplist, *OPTIONS)
        w.grid(column=1, row=1, padx=5)

        self.opmode_button = tk.Button(self.right_frame,
                                       text="Set config mode",
                                       command=self.changemode)
        self.opmode_button.grid(column=1, row=2, pady=5)

        # stop button
        self.stop_button = tk.Button(self.right_frame,
                                     text="STOP",
                                     command=self.stop)
        self.stop_button.grid(column=1, row=0, pady=5)

        # connect button
        self.connect_button = tk.Button(self.extra_frame,
                                        text="CONNECT",
                                        command=self.connect)
        self.connect_button.grid(column=0, row=2, pady=5)  # enlarge
        self.connect_button.config(height=3, width=15)

        # bit time button
        self.bittime = tk.Button(self.extra_frame,
                                 text="BIT TIME",
                                 command=self.bittime)
        self.bittime.grid(column=0, row=3, pady=5)

        # bit time droplist
        OPTIONS_bit = ["500k_2M", "500k_4M"]
        self.droplist_bit = tk.StringVar(self.extra_frame)
        self.droplist_bit.set(OPTIONS_bit[0])  # default value
        w = tk.OptionMenu(self.extra_frame, self.droplist_bit, *OPTIONS_bit)
        w.grid(column=0, row=4, padx=5)
        #self.droplist_bit.grid(column=0, row=4, pady=5)

        # dlc droplist and button
        OPTIONS_dlc = [
            "CAN_DLC_0", "CAN_DLC_1", "CAN_DLC_2", "CAN_DLC_3", "CAN_DLC_4",
            "CAN_DLC_5", "CAN_DLC_6", "CAN_DLC_7", "CAN_DLC_8", "CAN_DLC_12",
            "CAN_DLC_16", "CAN_DLC_20", "CAN_DLC_24", "CAN_DLC_32",
            "CAN_DLC_48", "CAN_DLC_64"
        ]

        self.droplist_dlc = tk.StringVar(self.extra_frame)
        self.droplist_dlc.set(OPTIONS_dlc[-1])  # default value

        w_dlc = tk.OptionMenu(self.extra_frame, self.droplist_dlc,
                              *OPTIONS_dlc)
        w_dlc.grid(column=0, row=0, padx=5)

        self.dlc_button = tk.Button(self.extra_frame,
                                    text="Set DLC",
                                    command=self.changedlc)
        self.dlc_button.grid(column=0, row=1, pady=5)

        self.canfd = None

        if self.debug:
            # self.window.after(1000, self.dummy_main)
            pass
        else:
            try:
                self.connect()
            except RuntimeError:
                self.rx_box_text.insert(
                    tk.END, "Device not ready. Connect manually." + '\n')
            finally:
                #self.window.after(10, self.main)
                self.main()
                self.window.mainloop()
Exemplo n.º 15
0
    def createPage(self):
        self.baseInfo = mtk.LabelFrame(self.root, text="当前用户", fg="blue")
        self.baseInfo.place(x=30, y=50, width=250, height=150)

        self.userName = mtk.Label(self.baseInfo, text="姓 名:")
        self.userName.place(x=20, y=10, width=80, height=25)
        self.userNameText = mtk.Entry(self.baseInfo)
        self.userNameText.place(x=110, y=10, width=100, height=25)
        self.userNameText.insert(0, self.NAME)
        self.userNameText.bind(sequence="<Return>",
                               func=lambda x: self.thread_it(self.updateName))
        self.taskName = mtk.Label(self.baseInfo, text="预约业务:")
        self.taskName.place(x=20, y=45, width=80, height=25)
        self.taskNameText = mtk.Label(self.baseInfo, text="人才引进落户申请")
        self.taskNameText.place(x=110, y=45, width=100, height=25)

        self.seetings = mtk.LabelFrame(self.root, text="设 置", fg="blue")
        self.seetings.place(x=320, y=50, width=250, height=150)

        self.taskDate = mtk.Label(self.seetings, text="预约日期:")
        self.taskDate.place(x=10, y=10, width=80, height=25)
        self.taskDateText = mtk.Entry(self.seetings)
        self.taskDateText.place(x=100, y=10, width=100, height=25)
        self.taskDateText.bind(sequence="<Double-Button-1>",
                               func=lambda x: self.thread_it(self.getDate))

        self.timeChoose = mtk.Label(self.seetings, text="预约时间:")
        self.timeChoose.place(x=10, y=50, width=80, height=25)
        self.timeChooseText = ttk.Combobox(self.seetings)
        self.timeChooseText.place(x=100, y=50, width=100, height=25)
        self.timeChooseText["values"] = ["09:00-12:00", "13:00-70:00"]

        self.taskSleep = mtk.Label(self.seetings, text="延时设置:")
        self.taskSleep.place(x=10, y=90, width=80, height=25)
        self.taskSleepText = mtk.Entry(self.seetings)
        self.taskSleepText.place(x=100, y=90, width=100, height=25)

        self.startBtn = mtk.Button(
            self.root,
            text="预约",
            command=lambda: self.thread_it(self.startTask))
        self.startBtn.place(x=470, y=440, width=100, height=30)

        self.stopBtn = mtk.Button(self.root,
                                  text="暂停",
                                  command=lambda: self.thread_it(self.stop))
        self.stopBtn.place(x=470, y=490, width=100, height=30)

        self.timeNow = mtk.LabelFrame(self.root, text="当前时间:", fg="blue")
        self.timeNow.place(x=450, y=270, width=150, height=120)

        self.timeNowText = mtk.Label(self.timeNow, fg="green")
        self.timeNowText.place(x=20, y=20, width=110, height=60)
        self.timeNowText["text"] = datetime.now().strftime(
            '%Y-%m-%d \n\n %H:%M:%S')

        self.logInfo = mtk.LabelFrame(self.root, text="日志信息", fg="blue")
        self.logInfo.place(x=30, y=230, width=400, height=350)

        self.logTxt = scrolledtext.ScrolledText(self.logInfo, fg="green")
        self.logTxt.place(x=20, y=15, width=360, height=290)
Exemplo n.º 16
0
    def creatUI(self):
        # 数据展示
        self.showData = mtk.LabelFrame(self.root, text="新任务", fg="blue")
        self.showData.place(x=20, y=20, width=760, height=510)

        title = ['1', '2', '3', '4', '5', '6']
        self.box = ttk.Treeview(self.showData, columns=title, show='headings')
        self.box.place(x=20, y=15, width=730, height=450)
        self.box.column('1', width=30, anchor='center')
        self.box.column('2', width=180, anchor='center')
        self.box.column('3', width=100, anchor='center')
        self.box.column('4', width=50, anchor='center')
        self.box.column('5', width=50, anchor='center')
        self.box.column('6', width=140, anchor='center')

        self.box.heading('1', text='序号')
        self.box.heading('2', text='任务名称')
        self.box.heading('3', text='悬赏主ID')
        self.box.heading('4', text='关键字')
        self.box.heading('5', text='赏金')
        self.box.heading('6', text='获取时间')

        self.VScroll1 = ttk.Scrollbar(self.box,
                                      orient='vertical',
                                      command=self.box.yview)
        self.VScroll1.pack(side="right", fill="y")
        self.box.configure(yscrollcommand=self.VScroll1.set)

        self.box.bind(sequence="<Double-Button-1>",
                      func=lambda x: self.thread_it(self.showDetail))

        # 日志
        self.logs = mtk.LabelFrame(self.root, text="log日志", fg="blue")
        self.logs.place(x=20, y=550, width=300, height=200)
        self.logtext = scrolledtext.ScrolledText(self.logs, fg="green")
        self.logtext.place(x=20, y=15, width=270, height=140)

        self.settings = mtk.LabelFrame(self.root, text="设置", fg="blue")
        self.settings.place(x=340, y=550, width=440, height=200)

        self.timeSleep = mtk.Label(self.settings, text="任务延时(分钟):")
        self.timeSleep.place(x=20, y=30, width=100, height=25)
        self.timeSleepText = mtk.Entry(self.settings)
        self.timeSleepText.place(x=120, y=30, width=80, height=25)

        self.timeNow = mtk.Label(self.settings, text="当前时间:")
        self.timeNow.place(x=20, y=100, width=70, height=25)
        self.timeNowText = mtk.Label(
            self.settings,
            text=str(datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
        self.timeNowText.place(x=100, y=100, width=150, height=25)

        self.startBtn = mtk.Button(self.settings,
                                   text="启动",
                                   command=lambda: self.thread_it(self.start))
        self.startBtn.place(x=280, y=30, width=100, height=30)

        self.stopBtn = mtk.Button(self.settings,
                                  text="退出",
                                  command=lambda: self.thread_it(self.stop))
        self.stopBtn.place(x=280, y=100, width=100, height=30)
Exemplo n.º 17
0
fig, ax = plt.subplots()
ax.set_title('Trajectory Viewer')
ax.set_xlabel('Joint 1')
ax.set_ylabel('Trajectory Point Index')
gp = Graph_Plotter(fig, ax)
"""
use mttkinter to avoid main thread issues

"""
top = tk.Tk()
#Code to add widgets goes here
angle_label = tk.Label(top, text="Joint Angle")
angle_label.grid(row=0, column=0)
#angle_label.pack(side=Tkinter.LEFT)
angle_value = tk.Entry(top, bd=5)
#angle_value.pack(side=Tkinter.RIGHT)
angle_value.grid(row=0, column=1)

point_label = tk.Label(top, text="Trajectory Point Index")
#point_label.pack(side=Tkinter.LEFT)
point_label.grid(row=1, column=0)
point_value = tk.Entry(top, bd=5)
#point_value.pack(side=Tkinter.RIGHT)
point_value.grid(row=1, column=1)

confirm = tk.Button(top, text="Confirm", command=receive_values_from_gui)  #
confirm.grid(row=2, column=1)

top.mainloop()
Exemplo n.º 18
0
    def __createGUI(self):
        self.root = mtk.Tk()
        self.root.title("移动惠购用户查询工具")
        self.root.geometry("720x600")

        self.settings = mtk.LabelFrame(text="设置", fg="blue")
        self.settings.place(x=50, y=20, width=600, height=130)

        self.shopId = mtk.Label(self.settings, text="店铺  ID:")
        self.shopId.place(x=30, y=10, width=60, height=20)
        self.shopIdText = mtk.Entry(self.settings)
        self.shopIdText.place(x=85, y=10, width=80, height=20)

        self.workNo = mtk.Label(self.settings, text="工   号:")
        self.workNo.place(x=200, y=10, width=60, height=20)
        self.workNoText = mtk.Entry(self.settings)
        self.workNoText.place(x=260, y=10, width=80, height=20)

        self.semaphoreNum = mtk.Label(self.settings, text="并发数量:")
        self.semaphoreNum.place(x=30, y=70, width=60, height=20)
        self.entrySemaphoreNum = mtk.Entry(self.settings)
        self.entrySemaphoreNum.place(x=85, y=70, width=80, height=20)

        self.timeSleep = mtk.Label(self.settings, text="延迟时间:")
        self.timeSleep.place(x=200, y=70, width=60, height=20)
        self.entrySleep = mtk.Entry(self.settings)
        self.entrySleep.place(x=260, y=70, width=80, height=20)

        self.statusNow = mtk.Label(self.settings, text="当前进度:")
        self.statusNow.place(x=420, y=10, width=60, height=20)
        self.statusNowText = mtk.Label(self.settings, text="0/0")
        self.statusNowText.place(x=450, y=50, width=60, height=20)

        self.showDataBox = mtk.LabelFrame(self.root, text="数据信息", fg="blue")
        self.showDataBox.place(x=50, y=170, width=400, height=400)
        title = ['1', '2', '3', '4']
        self.box = ttk.Treeview(self.showDataBox,
                                columns=title,
                                show='headings')
        self.box.place(x=20, y=15, width=360, height=340)
        self.box.column('1', width=50, anchor='center')
        self.box.column('2', width=100, anchor='center')
        self.box.column('3', width=50, anchor='center')
        self.box.column('4', width=160, anchor='center')
        self.box.heading('1', text='序号')
        self.box.heading('2', text='手机号')
        self.box.heading('3', text='优惠')
        self.box.heading('4', text='ERROR信息')
        self.VScroll1 = Scrollbar(self.box,
                                  orient='vertical',
                                  command=self.box.yview)
        self.VScroll1.pack(side="right", fill="y")
        self.box.configure(yscrollcommand=self.VScroll1.set)
        self.box.bind(sequence="<Double-Button-1>",
                      func=lambda x: self.thread_it(self.showDetail))

        self.btnBox = mtk.LabelFrame(self.root, text="任务栏", fg="blue")
        self.btnBox.place(x=480, y=170, width=170, height=400)

        self.fileBox = mtk.LabelFrame(self.btnBox)
        self.fileBox.place(x=15, y=30, width=140, height=120)

        self.loadExcel = mtk.Button(
            self.fileBox,
            text="导入Excel",
            command=lambda: self.thread_it(self.__loadExcel))
        self.loadExcel.place(x=15, y=20, width=100, height=30)
        self.btnEnd = mtk.Button(
            self.fileBox,
            text="导出Excel",
            command=lambda: self.thread_it(self.__saveExcel))
        self.btnEnd.place(x=15, y=70, width=100, height=30)

        self.btnBbox = mtk.LabelFrame(self.btnBox)
        self.btnBbox.place(x=15, y=200, width=140, height=120)
        self.btnStart = mtk.Button(self.btnBbox,
                                   text="开始",
                                   command=lambda: self.thread_it(self.start))
        self.btnStart.place(x=15, y=20, width=100, height=30)
        self.btnStop = mtk.Button(self.btnBbox,
                                  text="停止",
                                  command=lambda: self.thread_it(self.stop))
        self.btnStop.place(x=15, y=70, width=100, height=30)
Exemplo n.º 19
0
    def __init__(self, master, queue, endCommand):
        self.queue = queue

        self.status_label = dict()

        #Set up the GUI
        r = -1

        # XBotCore Dummy
        r += 1
        tk.Button(master,
                  text='Run XBotCore',
                  font='Helvetica 18 bold',
                  command=xbot).grid(row=r, column=0, pady=20)

        # plugins
        r += 1
        create_plugin_control(master, 'HomingExample', r, self.status_label)
        r += 1
        create_plugin_control(master, 'XBotCommunicationPlugin', r,
                              self.status_label)
        r += 1
        create_plugin_control(master, 'HeriHand', r, self.status_label)

        # HeriHand control
        percentage = tk.StringVar(root, value='0.0')
        #percentage.trace("w", lambda name, index, mode, percentage=percentage: callback(percentage))

        r += 1

        tk.Button(master,
                  text="Grasp",
                  font='Calibri 12',
                  command=lambda: heri_control("grasp", percentage)).grid(
                      row=r, column=1, pady=20)
        tk.Button(master,
                  text="Pinch",
                  font='Calibri 12',
                  command=lambda: heri_control("pinch", percentage)).grid(
                      row=r, column=2)
        tk.Button(master,
                  text="Tool Grasp",
                  font='Calibri 12',
                  command=lambda: heri_control("tool_grasp", percentage)).grid(
                      row=r, column=3)
        tk.Button(
            master,
            text="Tool Trigger",
            font='Calibri 12',
            command=lambda: heri_control("tool_trigger", percentage)).grid(
                row=r, column=4)

        r += 1

        tk.Label(
            master,
            text="Closure (0.0 to 1.0)",
            font='Calibri 12',
        ).grid(row=r, column=1, sticky=tk.W, padx=20, pady=20)

        e1 = tk.Entry(master, textvariable=percentage)
        e1.grid(row=r, column=2)

        #e1 = Entry(master)
        #e2 = Entry(master)

        #  CI
        b = tk.Button(master,
                      text='Cartesian Interface',
                      font='Helvetica 12 bold',
                      command=lambda: cartesian_interface())
        r += 1
        b.grid(row=r, column=0, rowspan=2, pady=20)
        b.config(bg='cyan')

        v = tk.IntVar()
        c1 = tk.Radiobutton(master,
                            text='WheeledMotion',
                            font='Helvetica 12',
                            variable=v,
                            value=0,
                            command=lambda: load_controller('WheeledMotion'))
        c1.grid(row=r, column=1, pady=20, sticky=tk.W)

        r += 1
        c2 = tk.Radiobutton(master,
                            text='OpenSot',
                            font='Helvetica 12',
                            variable=v,
                            value=1,
                            command=lambda: load_controller('OpenSot'))
        c2.grid(row=r, column=1, sticky=tk.W)

        #Quit
        tk.Button(master, text='Quit', font='Helvetica 12',
                  command=endCommand).grid(column=0, pady=20)