示例#1
0
def main():
    """Initialize the window and enter the Tkinter main loop."""
    top = tk.Tk()
    top.wm_title('PuTTY Color Manager')
    interface = ColorInterface(top, colorinterface.get_all_session_names())
    interface.pack()
    tk.mainloop()
	def __init__(self):
		# Create the main window.
		self.main_window = tkinter.Tk()

		# Create two frames to group widgets.
		self.top_frame = tkinter.Frame()
		self.bottom_frame = tkinter.Frame()

		# Create the widgets for the top frame.
		self.prompt_label = tkinter.Label(self.top_frame, \
		                                  text='Enter a distance in kilometers:')
		self.kilo_entry = tkinter.Entry(self.top_frame, \
		                                width=10)

		# Pack the top frame's widgets.
		self.prompt_label.pack(side='left')
		self.kilo_entry.pack(side='left')

		# Create the button widgets for the bottom frame.
		self.calc_button = tkinter.Button(self.bottom_frame, \
		                                  text='Convert', \
		                                  command=self.convert)
		self.quit_button = tkinter.Button(self.bottom_frame, \
		                                  text='Quit', \
		                                  command=self.main_window.destroy)
		# Pack the buttons.
		self.calc_button.pack(side='left')
		self.quit_button.pack(side='left')

		# Pack the frames.
		self.top_frame.pack()
		self.bottom_frame.pack()

		# Enter the tkinter main loop.
		tkinter.mainloop()
示例#3
0
文件: e4.py 项目: csscmaster3/LabWork
    def __init__(self):
        self.main_window=tkinter.Tk()
        self.top_frame = tkinter.Frame(self.main_window)
        self.bottom_frame=tkinter.Frame(self.main_window)

        self.label1=tkinter.Label(self.top_frame, text='Winken')
        self.label2=tkinter.Label(self.top_frame, text='Blinken')
        self.label3=tkinter.Label(self.bottom_frame, text='Nod')

        self.label1.pack(side='top')
        self.label2.pack(side='top')
        self.label3.pack(side='top')

        self.label4=tkinter.Label(self.top_frame, text='Winken')
        self.label5=tkinter.Label(self.top_frame, text='Blinken')
        self.label6=tkinter.Label(self.bottom_frame, text='Nod')

        self.label1.pack(side='left')
        self.label2.pack(side='left')
        self.label3.pack(side='left')

        self.top_frame.pack()
        self.bottom_frame.pack()

        tkinter.mainloop()
示例#4
0
    def __init__(self):

        self.main_window = tkinter.Tk()

        self.top_frame = tkinter.Frame()
        self.bottom_frame = tkinter.Frame()

        self.prompt_label = tkinter.Label(self.top_frame, text='Enter employee ID:')
        self.employee_entry = tkinter.Entry(self.top_frame, width=10)

        self.prompt_label.pack(side='left')
        self.employee_entry.pack(side='left')

        self.add_button = tkinter.Button(self.bottom_frame,text='Add', command=self.employee_add)
        self.edit_button = tkinter.Button(self.bottom_frame, text='Edit', command=self.employee_edit)
        self.payroll_button = tkinter.Button(self.bottom_frame, text='Payroll', command=self.employee_payroll)

        self.add_button.pack(side='left')
        self.edit_button.pack(side='left')
        self.payroll_button.pack(side='left')

        self.top_frame.pack()
        self.bottom_frame.pack()

        tkinter.mainloop()
示例#5
0
def main():

    class DownloadTaskHandler(Thread):

        def run(self):
            # 模拟下载任务需要花费10秒钟时间
            time.sleep(10)
            tkinter.messagebox.showinfo('提示', '下载完成!')
            # 启用下载按钮
            button1.config(state=tkinter.NORMAL)

    def download():
        # 禁用下载按钮
        button1.config(state=tkinter.DISABLED)
        # 通过daemon参数将线程设置为守护线程(主程序退出就不再保留执行)
        DownloadTaskHandler(daemon=True).start()

    def show_about():
        tkinter.messagebox.showinfo('关于', '作者: 骆昊(v1.0)')

    top = tkinter.Tk()
    top.title('单线程')
    top.geometry('200x150')
    top.wm_attributes('-topmost', 1)

    panel = tkinter.Frame(top)
    button1 = tkinter.Button(panel, text='下载', command=download)
    button1.pack(side='left')
    button2 = tkinter.Button(panel, text='关于', command=show_about)
    button2.pack(side='right')
    panel.pack(side='bottom')

    tkinter.mainloop()
示例#6
0
def main():
    master = tkinter.Tk()
    tkinter.Label(master, text="Query").grid(row=0)
    e1 = tkinter.Entry(master)
    e1.grid(row=0, column=1)
    tkinter.Button(master, text='Show', command=show_entry_fields).grid(row=3, column=1, sticky=tkinter.W, pady=4)
    tkinter.mainloop( )
def code_list():
    var2 = tk.StringVar()
    for each in codes.values():
        import os

        if each[1] == 0:
            my_file = open("Slist.txt", "a")
            my_file.write("\n")
            my_file.write(each[0])
            my_file.close()
            each[1] = 2
            continue

        def code_print():
            admin = var2.get()
            if admin == "-1":
                import os

                os.startfile("C:/Users/Tiger/Desktop/Login Files/Slist.txt", "print")

        class PrintSC:
            LARGE_FONT = ("Verdana", 39)
            label6 = tk.Label(text="    ", font=LARGE_FONT)
            label6.pack()
            label5 = tk.Label(text="Enter Admin Code to print", font=LARGE_FONT)
            label5.pack(pady=10, padx=10)
            entry2 = tk.Entry(textvariable=var2, width=35, font=LARGE_FONT)
            entry2.pack()
            button3 = tk.Button(text="Enter", command=code_print, width=10, font=LARGE_FONT)
            button3.pack()
            button4 = tk.Button(text="Exit", command=code_end, width=10, font=LARGE_FONT)
            button4.pack()

        tk.mainloop()
def begin(fl):
	global D,d
#fl=input("Enter the choice : " + str(D.keys()))
	#print("D : ",D)
	#read()
	print("D : ",D)
	global init_x
	global init_y
	init_x = float(d[1])/2
	init_y = float(d[0])/2
	flag = False
	l = []
	print("fl : ",fl)
	flag, l = check(flag, init_x,init_y,D[fl], l)
	print(flag)
	if not flag:
		print("hi")
		draw_plan(fl, init_x,init_y)
	else:
		a = tkinter.Tk()
		l = tkinter.Message(a,text = str(fl.upper())+" cannot be drawn because there is a dimension problem in ".upper()+str(l), aspect=400, font=("Segoe Script", 12, "italic"))
		l.config(bg = "black", fg = "white")
		l.pack(expand = tkinter.YES, fill = tkinter.BOTH)
		#print(i,"cannot be drawn because there is a dimension problem in",l)
	tkinter.mainloop()
示例#9
0
	def __init__(self):
		'''
		Constructor
		'''
		self.main_window = tkinter.Tk()
		self.top_frame = tkinter.Frame(self.main_window)
		self.mid_frame = tkinter.Frame(self.main_window)
		self.bottom_frame = tkinter.Frame(self.main_window)

		self.name_label = tkinter.Label(self.top_frame, text="Name:")
		self.name_entry = tkinter.Entry(self.top_frame, width=10)

		self.name_label.pack(side="left")
		self.name_entry.pack(side="left")

		# create a variable to store the greeting output and a label to update the greeting message in the window
		self.output_greeting = tkinter.StringVar()
		self.the_greeting = tkinter.Label(self.mid_frame, textvariable=self.output_greeting)
		self.the_greeting.pack(side="left")

		self.greeting_button = tkinter.Button(self.bottom_frame, text="Greet!", command=self.greet)
		self.exit_button = tkinter.Button(self.bottom_frame, text="Exit!", command=self.main_window.destroy)

		self.greeting_button.pack(side="top")
		self.exit_button.pack(side="top")

		self.top_frame.pack()
		self.mid_frame.pack()
		self.bottom_frame.pack()

		tkinter.mainloop()
示例#10
0
def guierror(message, title=None):
    """Creates tkinter standalone error window and exits afterwards

    :param str message: (multiline) message to display in the window's
        main widget. no word wrap will be performed
    :param str title: title of window
    :param bool fatal: whether to exit after showing the window
    """
    win = tk.Tk()
    if title is None:
        title = 'Error occurred'
    win.wm_title(title)

    msg = tk.Label(win, text=message, justify='left')
    msg.pack(side='top')
    #msg = tk.Text(win, width=40)
    #msg.tag_config('x', wrap='word', foreground='blue')
    #msg.insert('1.0', message, ('x,'))
    #msg.pack(side='top')
    #msg.config(state='disabled')

    def sysexit(e=None):
        sys.exit(0)
    ok = tk.Button(win, text='Ok', command=lambda: sys.exit(0))
    ok.pack()
    tk.mainloop()
    sys.exit(0)
示例#11
0
    def __init__(self):
        #create the main window widget
        self.main_window=tkinter.Tk()

        #Create a Button Widget. The text
        #Should appear on the face of the button. The
        #do_something method should execute when the
        #user click the Button.

        self.my_button1=tkinter.Button(self.main_window,                                      text='10 Digit ISBN Check',                                      command=self.check_digit_10)
        self.my_button2=tkinter.Button(self.main_window,                                        text='13 Digit ISBN Check',                                        command=self.check_digit_13)
        self.my_button3=tkinter.Button(self.main_window,                                       text='Convert 10 to 13 ISBN',                                       command=self.convert_10_to_13)
        self.my_button4=tkinter.Button(self.main_window,                                       text='Convert 13 to 10 ISBN',                                       command=self.convert_13_to_10)
        
    

        #Create a Quit Button. When this button is clicked the root
        #widget's destroy method is called.
        #(The main_window variable references the root widget, so the
        #callback function is self.main_window.destroy.)

        self.quit_button=tkinter.Button(self.main_window,                                        text='Quit',                                        command=self.main_window.destroy)
        #pack the buttons
        self.my_button1.pack()
        self.my_button2.pack()
        self.my_button3.pack()
        self.my_button4.pack()
        self.quit_button.pack()

        #Enter the tkinter main loop
        tkinter.mainloop()
示例#12
0
    def __init__(self):
        self.main_window = tkinter.Tk()

        self.top_frame = tkinter.Frame(self.main_window)
        self.middle_frame = tkinter.Frame(self.main_window)
        self.bottom_frame = tkinter.Frame(self.main_window)

        self.timeLabel = tkinter.Label(self.middle_frame, text='Enter Date in MM/DD/YYYY Format')
        self.startLabel = tkinter.Label(self.middle_frame, text = 'Start Date')
        self.start_entry = tkinter.Entry(self.middle_frame, width=10)
        self.endLabel = tkinter.Label(self.middle_frame, text="End Date")
        self.end_entry = tkinter.Entry(self.middle_frame, width=10)

        self.timeLabel.pack()
        self.startLabel.pack(side='left')
        self.start_entry.pack(side='left')
        self.endLabel.pack(side='left')
        self.end_entry.pack(side='left')

        self.enact_button = tkinter.Button(self.bottom_frame, text="Process Payroll", command=self.processChoice)
        self.quit_button = tkinter.Button(self.bottom_frame, text="Quit", command=self.main_window.destroy)

        self.enact_button.pack(side='left')
        self.quit_button.pack(side='left')

        self.top_frame.pack()
        self.middle_frame.pack()
        self.bottom_frame.pack()

        tkinter.mainloop()
示例#13
0
def trial(do_box, do_hull, n):
    print('generating n=' + str(n) + ' points...')
    points = random_points(n)
    hull = []
    
    if do_box:
        print('bounding box...')
        start = time.perf_counter()
        (x_min, y_min, x_max, y_max) = bounding_box(points)
        end = time.perf_counter()
        print('elapsed time = {0:10.6f} seconds'.format(end - start))

    if do_hull:
        print('convex hull...')
        start = time.perf_counter()
        hull = convex_hull(points)
        end = time.perf_counter()
        print('elapsed time = {0:10.6f} seconds'.format(end - start))

    w = tkinter.Canvas(tkinter.Tk(),
                       width=CANVAS_WIDTH, 
                       height=CANVAS_HEIGHT)
    w.pack()

    if do_box:
        w.create_polygon([canvas_x(x_min), canvas_y(y_min),
                          canvas_x(x_min), canvas_y(y_max),
                          canvas_x(x_max), canvas_y(y_max),
                          canvas_x(x_max), canvas_y(y_min)],
                         outline=BOX_OUTLINE_COLOR,
                         fill=BOX_FILL_COLOR,
                         width=OUTLINE_WIDTH)

    if do_hull:
        vertices = []
        for p in clockwise(hull):
            vertices.append(canvas_x(p.x))
            vertices.append(canvas_y(p.y))

        w.create_polygon(vertices,
                         outline=HULL_OUTLINE_COLOR,
                         fill=HULL_FILL_COLOR,
                         width=OUTLINE_WIDTH)
    #to aid in debug...
    for p in hull:
        w.create_oval(canvas_x(p.x) - POINT_RADIUS,
                      canvas_y(p.y) - POINT_RADIUS,
                      canvas_x(p.x) + POINT_RADIUS,
                      canvas_y(p.y) + POINT_RADIUS,
                      fill='magenta')
    
    for p in points:
        if p not in hull:
            w.create_oval(canvas_x(p.x) - POINT_RADIUS,
                      canvas_y(p.y) - POINT_RADIUS,
                      canvas_x(p.x) + POINT_RADIUS,
                      canvas_y(p.y) + POINT_RADIUS,
                      fill=INTERIOR_POINT_COLOR)

    tkinter.mainloop()
示例#14
0
def main():
    # CALLING THE Tk constructor
    root = tkinter.Tk()
    
    # Calling the Canvas constructor
    cv = tkinter.Canvas(root)
    
    #mutator method call
    cv.pack()
    
    # Calling the RawTurtle constructor
    t = turtle.RawTurtle(cv)
    
    # Called two accessor methods
    print(t.xcor(), t.ycor())
    
    screen = t.getscreen()
    
    screen.addshape("cards/back.gif")
    
    for i in range(1,53):
        screen.addshape("cards/"+str(i)+".gif")
    
    t.shape("cards/1.gif")
    
    t.goto(100,100)
    #c = Card(0, cv, "cards/back.gif","cards/1.gif")
    tkinter.mainloop()
示例#15
0
def mb_to_tkinter(maxiters, xmin, xmax, ymin, ymax, imgwd, imght):
    try:
        import tkinter as tk
    except ImportError:
        import Tkinter as tk
    
    array_ = get_mandelbrot(maxiters, xmin, xmax, ymin, ymax, imgwd, imght)
    window = tk.Tk()
    canvas = tk.Canvas(window, width=imgwd, height=imght, bg="#000000")
    img = tk.PhotoImage(width=imgwd, height=imght)
    canvas.create_image((0, 0), image=img, state="normal", anchor=tk.NW)

    i = 0
    for y in range(imght):
        for x in range(imgwd):
            n = array_[i]
            color = escapeval_to_color(n, maxiters)
            r = hex(color[0])[2:].zfill(2)
            g = hex(color[1])[2:].zfill(2)
            b = hex(color[2])[2:].zfill(2)
            img.put("#" + r + g + b, (x, y))     
            i += 1
            
    println("mb_to_tkinter %s" % time.asctime())
    canvas.pack()
    tk.mainloop()
示例#16
0
    def __init__(self):
        self.winMain = tk.Tk()
        self.topFrame = tk.Frame(self.winMain)
        self.botFrame = tk.Frame(self.winMain)

        self.celsiusLabel = tk.Label(self.topFrame, text = "Celsius temperature",width=25)
        self.celsiusLabel.pack(side="left")

        self.convert = tk.Button(self.topFrame, text = "Convert",width=20,command=self.convert)
        self.convert.pack(side="right")

        self.fahrLabel = tk.Label(self.topFrame, text = "Fahrenheit temperature", width = 30)
        self.fahrLabel.pack(side="right")

        self.cIn = tk.Entry(self.botFrame,width=25)
        self.cIn.pack(side="left")

        self.quit = tk.Button(self.botFrame,text="Quit",width=20)
        self.quit.pack(side="right")

        self.fValue = tk.StringVar()
        self.fLabel = tk.Label(self.botFrame,width=30, textvariable=self.fValue)
        self.fLabel.pack(side="right")

        self.topFrame.pack(side="top")
        self.botFrame.pack(side="bottom")
        tk.mainloop()
示例#17
0
文件: gui.py 项目: sumpatel/paddocks
	def __init__(self):
		self.main_window = tkinter.Tk() #Create main window
		self.main_window.title('Paddocks - T3 G3')
		
		main_frame = self.create_frame() #Creates the main frame

		menu_frame = self.create_menu() #Create a menu to save, load, and quit
		
		title = tkinter.Label(self.main_window, \
						text = 'PADDOCKS', \
						font = ('Comic Sans MS',16)) # this is a lemonade stand right?

		file_instruct = tkinter.Label(self.main_window, \
						text = 'File to load / Save as :', \
						font = ('Comic Sans MS',10)) # this is a lemonade stand right?

		self.file_entry = tkinter.Entry(self.main_window, \
						width = 24) # lets user specify the file name to load/save
						
		instruct = tkinter.Label(self.main_window, \
						text = "HOW TO PLAY:\n- First person to finish 5 boxes wins!\n- Your boxes are marked with (H) and the computers are marked with (C).\n- To save or load a game, type in the name of the file you want to save as, or load.", \
						wraplength = 200)
						
		# specifies how the widgets above are placed in the window.				
		title.grid(row = 0, column = 0)
		file_instruct.grid(row = 1, column = 0)
		main_frame.grid(row = 2, column = 0)
		self.file_entry.grid(row = 1, column = 1)
		instruct.grid(row = 2, column = 1)
		menu_frame.grid(row = 0, column = 1)
		
		tkinter.mainloop()
def main():
    #Main wird ausgeführt, wenn das Programm vom Terminal aus gestartet wird
    par = Parameter()
    
    dataQueue = queue.Queue()
    rauschenQueue = queue.Queue()
    plotQueue = queue.Queue()
   
    #Aufruf Ausgabe
    threadP = ausgabe(plotQueue, par) 
    
    threads = []
  
    #Start Lese-Thread
    threadL = leseThread(dataQueue, rauschenQueue, par)
    threadL.start()
    threads.append(threadL)
    
    #Start FFT-Thread
    threadF = fftThread(dataQueue, plotQueue, rauschenQueue, par)
    threadF.start()
    threads.append(threadF)
    
    tk.mainloop()  
    
    
    #warten, bis alle threads fertig
    for t in threads:
        t.join()
示例#19
0
文件: mygui.py 项目: konrad46/PART5_2
    def __init__(self):
        self.main_window = tkinter.Tk()
        self.main_window.geometry('300x250+500+200')

        self.frame = tkinter.Frame(self.main_window)

        self.labelspace = tkinter.Label(self.frame, text='')
        self.label = tkinter.Label(self.frame, text='Main Menu')
        self.labelspace2 = tkinter.Label(self.frame, text='')

        self.new_emp_button = tkinter.Button(self.frame, width='25', bg='white', text='New employee')
        self.view_timecards_button = tkinter.Button(self.frame, width='25', bg='white', text='View timecards')
        self.view_pay_rate_button = tkinter.Button(self.frame, width='25', bg='white', text='View salary info')
        self.view_sales_data_button = tkinter.Button(self.frame, width='25', bg='white', text='View sales info')
        self.change_pay_meth_button = tkinter.Button(self.frame, width='25', bg='white', text='Change payment method')
        self.process_payroll_button = tkinter.Button(self.frame, width='25', bg='white', text='Process payroll',
                                                     command=self.process_payroll_gui)

        self.frame.pack()
        self.labelspace.pack()
        self.label.pack()
        self.labelspace2.pack()
        self.new_emp_button.pack()
        self.view_timecards_button.pack()
        self.view_pay_rate_button.pack()
        self.view_sales_data_button.pack()
        self.change_pay_meth_button.pack()
        self.process_payroll_button.pack()

        tkinter.mainloop()
    def __init__(self):

        def ok_button():
            self.main_window.destroy()
            src.views.main_gui.MainGUI()

        self.main_window = tkinter.Tk()

        self.bottom_frame = tkinter.Frame(self.main_window)

        canvas = Canvas(width=1250, height=720, bg='black')

        canvas.pack(expand=YES, fill=BOTH)

        gif2 = PhotoImage(file='../src/images/wallpaper.gif')
        canvas.create_image(0, 0, image=gif2, anchor=NW)

        response = Label(canvas, text= 'Payroll Process Complete' , fg='white', bg='black')
        response.pack
        response_window = canvas.create_window(448, 335, anchor=NW, window=response)

        start_button = Button(canvas, text="Return to Main Menu", command=ok_button, anchor=W)
        start_button.configure(width=15, activebackground="#33B5E5", relief=FLAT)
        start_button_window = canvas.create_window(450, 375, anchor=NW, window=start_button)

        quit_button = Button(canvas, text='Quit', command=self.main_window.destroy, anchor=W)
        quit_button.configure(width=10, activebackground="#33B5E5", relief=FLAT)
        quit_button_window = canvas.create_window(1080, 600, anchor=NW, window=quit_button)

        tkinter.mainloop()
示例#21
0
文件: gui.py 项目: DannySchick/coding
    def __init__(self):
        # create frames and main window
        self.main_window = tkinter.Tk()
        self.top_frame = tkinter.Frame(self.main_window)
        self.bottom_frame = tkinter.Frame(self.main_window)
        # create top labels
        self.value = tkinter.StringVar() # this creates a variable for the my_label label to use
        self.my_label = tkinter.Label(self.top_frame,textvariable=self.value)
        self.value.set("YOUR NUMBER HERE")
        self.my_label.pack()

        self.my_label2 = tkinter.Label(self.top_frame,text = "Enter a number")
        self.my_label2.pack()
        # input box
        self.input = tkinter.Entry(self.bottom_frame,width = 10)
        self.input.pack()
        # create button
        self.my_button = tkinter.Button(self.bottom_frame,text = "Enter",command = self.button_function)
        self.my_button.pack(side="right")
        # create quit button
        self.quit_button = tkinter.Button(self.bottom_frame,text = "Quit",command = self.main_window.destroy)
        self.quit_button.pack(side="left")
        # pack frames, enter loop
        self.top_frame.pack(side = "top")
        self.bottom_frame.pack(side = "bottom")
        tkinter.mainloop()
示例#22
0
文件: e3.py 项目: csscmaster3/LabWork
 def __init__(self):
     self.main_window = tkinter.Tk()
     self.label1 = tkinter.Label(self.main_window, text="Hello World!")
     self.label2 = tkinter.Label(self.main_window, text="This is my GUI program.")
     self.label1.pack(side="left")
     self.label2.pack(side="left")
     tkinter.mainloop()
    def __init__(self):

        def run_payroll_button():
            self.main_window.destroy()
            src.accounting.run_payroll.RunPayroll()
            src.views.payroll_complete_gui.RunPayrollGUI()

        def cancel_payroll_button():
            self.main_window.destroy()
            src.views.main_gui.MainGUI()

        self.main_window = tkinter.Tk()

        self.bottom_frame = tkinter.Frame(self.main_window)

        canvas = Canvas(width=1250, height=720, bg='black')

        canvas.pack(expand=YES, fill=BOTH)

        gif2 = PhotoImage(file='../src/images/wallpaper.gif')
        canvas.create_image(0, 0, image=gif2, anchor=NW)

        start_button = Button(canvas, text="Start Daily Payroll", command=run_payroll_button, anchor=W)
        start_button.configure(width=15, activebackground="#33B5E5", relief=FLAT)
        start_button_window = canvas.create_window(450, 375, anchor=NW, window=start_button)

        cancel_button = Button(canvas, text="Cancel", command=cancel_payroll_button, anchor=W)
        cancel_button.configure(width=15, activebackground="#33B5E5", relief=FLAT)
        cancel_button_window = canvas.create_window(650, 375, anchor=NW, window=cancel_button)

        tkinter.mainloop()
示例#24
0
def _selftest():
	class content:
		def __init__(self):
			Button(self, text='Larch', command=self.quit).pack()
			Button(self, text='Sing', command=self.destroy).pack()

	class contentmix(MainWindow, content):
		def __init__(self):
			MainWindow.__init__(self, 'mixin', 'Main')
			content.__init__(self)

	contentmix()

	class contentmix(PopupWindow, content):
		def __init__(self):
			PopupWindow.__init__(self, 'mixin', 'Popup')
			content.__init__(self)
	prev = contentmix()

	class contentmix(ComponentWindow, content):
		def __init__(self):
			ComponentWindow.__init__(self, prev)
			content.__init__(self)
	contentmix()

	class contentsub(PopupWindow):
		def __init__(self):
			PopupWindow.__init__(self, 'popup', 'subclass')
			Button(self, text='Pine', command=self.quit).pack()
			Button(self, text='Sing', command=self.destroy).pack()
	contentsub()
	win = PopupWindow('popup', 'attachment')
	Button(win, text='Redwood', command=win.quit).pack()
	Button(win, text='Sing', command=win.destroy).pack()
	mainloop()
def game_play():

    s= input("Resume (y/n)?")
    
    if s=="y":
        file = open("Nathansettings",'rb')
        x = pickle.load(file)
        y = pickle.load(file)
        file.close()
    else: x=y=100
    
    game_map = Map()
    game_map.x = x
    game_map.y = y

    game_map.make_arc()
    game_map.draw()

    
    # this tells the graphics system to go into an infinite loop and just follow whatever events come along.
    tkinter.mainloop()
    s= tkinter.messagebox.askyesno("Save state","Save?")
    if s:
        file = open("Nathansettings",'wb')
        pickle.dump(game_map.x,file)
        pickle.dump(game_map.y,file)
        file.close()

    print("Thanks for playing")
    game_map.root.destroy()
示例#26
0
    def PropExchange2(self):
        # Get user input from previous gui
        wantProp= self.propEntry.get()

        # Destroy previous Gui
        self.PropExchangeGUI1.destroy()

        # Validate player input
        if wantProp in self.__Danny.get_PropertyDict() or wantProp == 'None':
            self.__TradeList.append(wantProp)
            
            # Create new GUI to get name of properties the player wants to give up
            self.PropExchangeGUI2= tkinter.Tk(className=' Trading Property')

            # Display message to player
            self.propLabel= tkinter.Label(self.PropExchangeGUI2, text='Enter the name of the property you want to give up:')
            # Get player to enter name
            self.propEntry= tkinter.Entry(self.PropExchangeGUI2, width=20)
            # Create 'Confirm' button
            self.confirmButton= tkinter.Button(self.PropExchangeGUI2, text='Confirm', command=self.PropExchange3)

            # Pack Label, Entry and Button
            self.propLabel.pack()
            self.propEntry.pack()

            self.confirmButton.pack()
            tkinter.messagebox.showinfo(self.__Player.get_name() + "'s Property List", self.__Player.get_name() + 's Property List:\n' + self.__Player.getPropListasString())
            print("-- ", self.__Player.get_name(), "'s Property --", sep='')
            print('\n' + self.__Player.getPropListasString())
            tkinter.mainloop()
        else:
            tkinter.messagebox.showinfo('Warning', wantProp + " is not owned by Danny.\nEnter another property.")
            # Call the previous gui again to allow the player to reenter name
            self.PropExchange1()
示例#27
0
    def PropExchange3(self):
        # Get the user input fron the previous gui
        giveProp= self.propEntry.get()

        # Destroy previous Gui
        self.PropExchangeGUI2.destroy()

        # Validate player input
        if giveProp in self.__Player.get_PropertyDict() or giveProp == 'None':
            self.__TradeList.append(giveProp)
            
            # Create new GUI to get how much cash the player wants to give up or get
            self.PropExchangeGUI3= tkinter.Tk(className=' Trading Property')
                           
            # Display message to player
            self.cashLabel= tkinter.Label(self.PropExchangeGUI3, text='How much cash do you want to give?')
            # Get player to enter number
            self.cashEntry= tkinter.Entry(self.PropExchangeGUI3, width=20)
            # Create 'Confirm' button
            self.confirmButton= tkinter.Button(self.PropExchangeGUI3, text='Confirm', command=self.PropExchangeAction)

            # Pack Label, Entry and Button
            self.cashLabel.pack()
            self.cashEntry.pack()

            self.confirmButton.pack()

            tkinter.messagebox.showinfo('Information', "Enter a negative to GET cash from computer.\nEg. -240.90")
            tkinter.mainloop()
        else:
            tkinter.messagebox.showinfo('Warning', giveProp + " is not owned by you, squatter.\nEnter a property you LEGALLY own.")
            # Call the previous gui again to allow the player to reenter name
            self.PropExchange2()
	def after_install_gui(self):


		top = tkinter.Tk()
		top.geometry('300x150')
		top.title("AutoTrace")

		label = tkinter.Label(top, text = "Welcome to Autotrace!",
			font = 'Helvetica -18 bold')
		label.pack(fill=tkinter.Y, expand=1)

		folder = tkinter.Button(top, text='Click here to view Autotrace files',
			command = lambda: (os.system("open "+self.github_path)))
		folder.pack()

		readme = tkinter.Button(top, text='ReadMe',
			command = lambda: (os.system("open "+os.path.join(self.github_path, "README.md"))), activeforeground ='blue',
			activebackground = 'green')
		readme.pack()

		apilsite = tkinter.Button(top, text='Look here for more info on the project',
			command = lambda: (webbrowser.open("http://apil.arizona.edu")), activeforeground = 'purple',
			activebackground = 'orange')
		apilsite.pack()

		quit = tkinter.Button(top, text='Quit',
			command=top.quit, activeforeground='red',
			activebackground='black')
		quit.pack()

		tkinter.mainloop()
示例#29
0
	def __init__(self):
		# Create the main window widget.
		self.main_window = tkinter.Tk()

		# Create a Button widget. The text 'Click Me!'
		# should appear on the face of the Button. The
		# do_something method should be executed when
		# the user clicks the Button.
		self.my_button = tkinter.Button(self.main_window, \
		                                text='Click Me!', \
		                                command=self.do_something)

		# Create a Quit button. When this button is clicked
		# the root widget's destroy method is called.
		# (The main_window variable references the root widget,
		# so the callback function is self.main_window.destroy.)
		self.quit_button = tkinter.Button(self.main_window, \
		                                  text='Quit', \
		                                  command=self.main_window.destroy)

		# Pack the Buttons.
		self.my_button.pack()
		self.quit_button.pack()

		# Enter the tkinter main loop.
		tkinter.mainloop()
def contentChoiceDialog(parent):
    root = tkinter.Toplevel(parent)
    root.title('Content Selection')  
    global radio_result
    radio_result = tkinter.IntVar()
    number_of_columns = 3
    canvas_width = 220 * number_of_columns #Text box width + 2*padx
    canvas_height = 220 * 2 + 20 #(Text box height + 2*pady) * number of rows to display +20 pixels for submit button
    canvas_size = (canvas_width, canvas_height)
    content_choice = {'result' : None}

    root.grab_set()
    root.focus_set()
      
    main_frame = createMainFrame(root, canvas_size)

    query_results = sql.queryAll()
    
    my_list = makeListOfTextObjects(main_frame, query_results)
    createTextGrid(my_list, number_of_columns)
    addButtons(main_frame, number_of_columns, content_choice, root)

    root.bind("<Return>", lambda event: chooseContent(content_choice, root))
    root.bind("<Escape>", lambda event: cancelChoice(content_choice, root))

    tkinter.mainloop()

    return content_choice['result']
示例#31
0
 def mainloop(self):
     if self.imgicon:
         self.top.tk.call('wm', 'iconphoto', self.top._w, self.imgicon)
     tk.mainloop()
示例#32
0
def main(argv=None):
    parser = argparse.ArgumentParser(
        description="Tkinter interface for PINT pulsar timing tool")
    parser.add_argument("parfile", help="parfile to use")
    parser.add_argument("timfile", help="timfile to use")
    parser.add_argument("--ephem", help="Ephemeris to use", default=None)
    parser.add_argument(
        "--test",
        help="Build UI and exit. Just for unit testing.",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "-f",
        "--fitter",
        type=str,
        choices=(
            "auto",
            "downhill",
            "WLSFitter",
            "GLSFitter",
            "WidebandTOAFitter",
            "PowellFitter",
            "DownhillWLSFitter",
            "DownhillGLSFitter",
            "WidebandDownhillFitter",
            "WidebandLMFitter",
        ),
        default="auto",
        help=
        "PINT Fitter to use [default='auto'].  'auto' will choose WLS/GLS/WidebandTOA depending on TOA/model properties.  'downhill' will do the same for Downhill versions.",
    )
    parser.add_argument(
        "-v",
        "--version",
        default=False,
        action="store_true",
        help="Print version info and  exit.",
    )
    parser.add_argument(
        "--log-level",
        type=str,
        choices=("TRACE", "DEBUG", "INFO", "WARNING", "ERROR"),
        default="WARNING",
        help="Logging level",
        dest="loglevel",
    )
    args = parser.parse_args(argv)

    if args.version:
        print(f"This is PINT version {pint.__version__}")
        sys.exit(0)

    if args.loglevel != "WARNING":
        log.remove()
        log.add(
            sys.stderr,
            level=args.loglevel,
            colorize=True,
            format=pint.logging.format,
            filter=pint.logging.LogFilter(),
        )

    root = tk.Tk()
    root.minsize(1000, 800)
    if not args.test:
        app = PINTk(
            root,
            parfile=args.parfile,
            timfile=args.timfile,
            fitter=args.fitter,
            ephem=args.ephem,
            loglevel=args.loglevel,
        )
        root.protocol("WM_DELETE_WINDOW", root.destroy)
        img = tk.Image("photo", file=pint.pintk.plk.icon_img)

        root.tk.call("wm", "iconphoto", root._w, img)
        tk.mainloop()
示例#33
0
"""
鼠标移动事件
"""
import tkinter as tk

root = tk.Tk()


def _printCoords(events):
    print(events.x, events.y)


# 创建第一个 BUTTON ,并与左键移动事件绑定

bt1 = tk.Button(root, text="left button")
bt1.bind("<B1-Motion>", _printCoords)

# 鼠标右键移动事件绑定
bt2 = tk.Button(root, text="right button")
bt2.bind("<B3-Motion>", _printCoords)

# 鼠标中间移动事件绑定
bt3 = tk.Button(root, text='middle butotn')
bt3.bind("<B2-Motion>", _printCoords)

bt1.grid()
bt2.grid()
bt3.grid()

tk.mainloop()
示例#34
0
        select_file = tkinter.Button(self.top,
                                     text="SELECT A PDF",
                                     command=self.addfile)
        select_file.pack(fill=tkinter.X)

        cut = tkinter.Button(self.top,
                             text="START TO CUT",
                             command=lambda: verticalCut(self.filename))
        cut.pack(fill=tkinter.X)

    def addfile(self):
        self.filename = tkinter.filedialog.askopenfilename()
        tip = tkinter.Label(self.top, text='INPUT FILE: ' + self.filename)
        tip.pack()

    def center_window(self, w, h):
        # 获取屏幕 宽、高
        ws = self.top.winfo_screenwidth()
        hs = self.top.winfo_screenheight()
        # 计算 x, y 位置
        x = (ws / 2) - (w / 2)
        y = (hs / 2) - (h / 2)
        self.top.geometry('%dx%d+%d+%d' % (w, h, x, y))


if __name__ == "__main__":
    frame = Frame()
    frame.center_window(400, 100)
    tkinter.mainloop()
示例#35
0
    def init_window(self):
        # Create the main window.
        self.main_window = tkinter.Tk(className=" Shoppers Billing")

        # Initiliazing window size.
        self.main_window.geometry("1024x768")

        # closing the current windows on clicking X(close) button of window

        # create a Menu widget adding to main window
        self.filemenu = tkinter.Menu(self.main_window)
        # display the menu on main window
        self.main_window.config(menu=self.filemenu)

        # create menu widget adding to main menu widget created above
        self.fmenuWid = tkinter.Menu(self.filemenu, tearoff=0)
        self.fmenuWid2 = tkinter.Menu(self.filemenu, tearoff=0)

        # create a toplevel menu
        self.filemenu.add_cascade(label="File", menu=self.fmenuWid)
        self.filemenu.add_cascade(label="Help", menu=self.fmenuWid2)

        # create a  menu inside options
        self.fmenuWid.add_command(label="Logout", command=self.logout)
        self.fmenuWid.add_command(label="Exit(Application)",
                                  command=self.clientSystemExit)
        self.fmenuWid2.add_command(label="About Us", command=self.aboutUs)

        # created frames for main window
        self.frame1 = tkinter.Frame(self.main_window)
        self.frame2 = tkinter.Frame(self.main_window)
        self.frame3 = tkinter.Frame(self.main_window)
        self.frame4 = tkinter.Frame(self.main_window)
        self.frame5 = tkinter.Frame(self.main_window)
        self.frame6 = tkinter.Frame(self.main_window)
        self.frame7 = tkinter.Frame(self.main_window)
        self.frame8 = tkinter.Frame(self.main_window)

        #initialized variabled to be used for dynamic billing details generation
        self.value1 = tkinter.StringVar()
        self.prodNum = tkinter.StringVar()
        self.prodP = tkinter.StringVar()
        self.prodUnits = tkinter.StringVar()
        self.amount = tkinter.StringVar()

        # created labels widgets for the frames
        self.label1 = tkinter.Label(self.frame1,
                                    text="Billing Application",
                                    font=("", 18),
                                    pady=80)

        #created label for frame2
        self.label2 = tkinter.Label(self.frame2,
                                    text="Product Number ",
                                    font=("", 14),
                                    padx=54)
        #created entry for product num
        self.entry1 = tkinter.Entry(self.frame2, width=25)

        # created label for frame3
        self.label3 = tkinter.Label(self.frame3,
                                    text="Number of Units",
                                    font=("", 14),
                                    padx=58)
        # created entry for product units
        self.entry2 = tkinter.Entry(self.frame3, width=25)

        # created label for frame4
        self.label4 = tkinter.Label(self.frame4,
                                    text="Status : ",
                                    font=("", 12),
                                    padx=20)
        self.label5 = tkinter.Label(self.frame4,
                                    textvariable=self.value1,
                                    font=("", 10),
                                    padx=20)

        #creatd buttons for adding product and generatig bill
        self.myButton1 = tkinter.Button(self.frame5,
                                        width=15,
                                        text='Add To Cart',
                                        command=self.productAdd)
        self.myButton2 = tkinter.Button(self.frame5,
                                        width=15,
                                        text='Generate Bill',
                                        command=self.generateBill)
        self.myButton4 = tkinter.Button(self.frame5,
                                        width=15,
                                        text='Remove from Cart',
                                        command=self.productRemove)

        # create button go back to main menu
        self.myButton3 = tkinter.Button(self.frame8,
                                        width=15,
                                        text='Back to main menu',
                                        command=self.clientExit)

        # created label for productnum, num of units and amount
        self.label6 = tkinter.Label(self.frame6,
                                    text="Product Number ",
                                    font=("", 12),
                                    padx=20)
        self.label12 = tkinter.Label(self.frame6,
                                     text="Product Price",
                                     font=("", 12),
                                     padx=20)
        self.label7 = tkinter.Label(self.frame6,
                                    text="Number of Units",
                                    font=("", 12),
                                    padx=20)
        self.label8 = tkinter.Label(self.frame6,
                                    text="Amount ",
                                    font=("", 12),
                                    padx=20)

        #created labels for dynamic generation of the add products details
        self.label9 = tkinter.Label(self.frame7,
                                    textvariable=self.prodNum,
                                    font=("", 10),
                                    padx=80)
        self.label13 = tkinter.Label(self.frame7,
                                     textvariable=self.prodP,
                                     font=("", 10),
                                     padx=60)
        self.label10 = tkinter.Label(self.frame7,
                                     textvariable=self.prodUnits,
                                     font=("", 10),
                                     padx=60)
        self.label11 = tkinter.Label(self.frame7,
                                     textvariable=self.amount,
                                     font=("", 10),
                                     padx=50)

        #labels pack
        self.label1.pack()
        self.label2.pack(side="left")
        self.label3.pack(side="left")
        self.label4.pack(side="left")
        self.label5.pack(side="left")
        #self.label6.pack(side="left")
        #self.label12.pack(side="left")
        #self.label7.pack(side="left")
        #self.label8.pack(side="left")
        self.label9.pack(side="left")
        self.label13.pack(side="left")
        self.label10.pack(side="left")
        self.label11.pack(side="left")

        #entry widget pack
        self.entry1.pack()
        self.entry2.pack()

        #buttons pack
        self.myButton3.pack(side="left")
        self.myButton1.pack(side="left", padx=10)
        self.myButton2.pack(side="left", padx=30)
        self.myButton4.pack(side="left")

        #frames pack
        self.frame8.pack(pady=10)
        self.frame1.pack()
        self.frame2.pack(pady=10)
        self.frame3.pack(pady=10)
        self.frame4.pack(pady=10)
        self.frame5.pack(pady=50)
        self.frame6.pack(pady=10)
        self.frame7.pack(pady=10)

        # tkinter mainloop to keep the window running
        tkinter.mainloop()
示例#36
0
    def generateBill(self):
        #self.id = uuid.uuid1()
        self.date = datetime.date.today()
        self.billId = str(uuid.uuid4().fields[-1])[:5]
        #checking if a product is added
        if (len(self.prodNumList) == 0):
            tkinter.messagebox.showinfo("Alert", "No Products Added")
        #generation of bill in a new child window
        else:
            self.sno = 1
            self.subtotalTable = 0
            for values in self.prodNumList:
                #print(values)
                listIndex = self.prodNumList.index(values)
                produnit = self.prodUnitsList[listIndex]
                prodpric = self.prodPriceList[listIndex]
                prodamount = (float(produnit) * float(prodpric))
                sql1 = "insert into billingdetails values(%s, %s, %s, %s, %s)"
                val1 = (
                    self.billId,
                    self.sno,
                    values,
                    produnit,
                    prodamount,
                )
                self.mycursor.execute(sql1, val1)

                self.subtotalTable = self.subtotalTable + prodamount

                sqlRemove = "update inventory set prodUnits = produnits - %s where prodnum = %s "
                valRemove = (
                    produnit,
                    values,
                )
                self.mycursor.execute(sqlRemove, valRemove)

                self.sno += 1
                self.mydb.commit()

            self.taxTotal = (13 * (self.subtotalTable / 100))
            self.totalAmountTable = self.subtotalTable + self.taxTotal
            sql2 = "insert into billing values(%s, %s, %s, %s, %s)"
            val2 = (self.billId, self.date, self.subtotalTable, self.taxTotal,
                    self.totalAmountTable)
            self.mycursor.execute(sql2, val2)
            self.mydb.commit()
            #created a child window
            self.child_window = tkinter.Tk(className=" Bill ")
            #initialized the size of the window
            self.child_window.geometry("1024x768")
            #created frames using Frame widget
            self.child_frame1 = tkinter.Frame(self.child_window)
            self.child_frame2 = tkinter.Frame(self.child_window)
            self.child_frame3 = tkinter.Frame(self.child_window)
            self.child_frame3 = tkinter.Frame(self.child_window)
            self.child_frame4 = tkinter.Frame(self.child_window)
            self.child_frame5 = tkinter.Frame(self.child_window)
            self.child_frame6 = tkinter.Frame(self.child_window)
            self.child_frame7 = tkinter.Frame(self.child_window)

            #temp variables for dynamic content generation
            self.billId = "Bill#" + "\n\n" + self.billId
            self.prodNumber = "Product Number" + "\n\n"
            self.prodGenerateUnits = "Product Units" + "\n\n"
            self.prodAmount = "Amount" + "\n\n"
            self.subtotal = 0

            #fetching details of the added products
            for items in range(len(self.prodNumList)):
                self.prodNumber = self.prodNumber + (
                    str(self.prodNumList[items]) + '\n')
            for items in range(len(self.prodUnitsList)):
                self.prodGenerateUnits = self.prodGenerateUnits + (
                    str(self.prodUnitsList[items]) + '\n')
            for items in range(len(self.amountList)):
                self.prodAmount = self.prodAmount + (
                    str(self.amountList[items]) + '\n')

            #calculating sub total of all the products
            for items in range(len(self.amountList)):
                self.subtotal = self.subtotal + self.amountList[items]

            #calculating hst
            self.hst = (self.subtotal * 13) / 100

            #calculating total amount including hst
            self.totalAmount = float("{:.2f}".format(self.subtotal + self.hst))

            #creating labels for bill generation details
            self.child_label1 = tkinter.Label(self.child_frame1,
                                              text="Billing Details",
                                              font=("", 16),
                                              pady=40)
            self.child_label14 = tkinter.Label(self.child_frame2,
                                               text="Bill#",
                                               font=("", 12),
                                               padx=60)
            self.child_label2 = tkinter.Label(self.child_frame2,
                                              text="Product Number",
                                              font=("", 12),
                                              padx=60)
            self.child_label3 = tkinter.Label(self.child_frame2,
                                              text="Product Units",
                                              font=("", 12),
                                              padx=60)
            self.child_label4 = tkinter.Label(self.child_frame2,
                                              text="Amount",
                                              font=("", 12),
                                              padx=40)
            self.child_label15 = tkinter.Label(self.child_frame3,
                                               text=self.billId,
                                               font=("", 12),
                                               padx=50,
                                               pady=10)
            self.child_label5 = tkinter.Label(self.child_frame3,
                                              text=self.prodNumber,
                                              font=("", 12),
                                              padx=100,
                                              pady=10)
            self.child_label6 = tkinter.Label(self.child_frame3,
                                              text=self.prodGenerateUnits,
                                              font=("", 12),
                                              padx=100,
                                              pady=10)
            self.child_label7 = tkinter.Label(self.child_frame3,
                                              text=self.prodAmount,
                                              font=("", 12),
                                              padx=40,
                                              pady=10)
            self.child_label8 = tkinter.Label(self.child_frame4,
                                              text="SubTotal",
                                              font=("", 12),
                                              padx=125,
                                              pady=10)
            self.child_label9 = tkinter.Label(self.child_frame4,
                                              text=self.subtotal,
                                              font=("", 12),
                                              pady=10)
            self.child_label10 = tkinter.Label(self.child_frame5,
                                               text="Hst(13%)",
                                               font=("", 12),
                                               padx=120,
                                               pady=10)
            self.child_label11 = tkinter.Label(self.child_frame5,
                                               text=self.hst,
                                               font=("", 12),
                                               pady=10)
            self.child_label12 = tkinter.Label(self.child_frame6,
                                               text="Total",
                                               font=("", 12),
                                               padx=130,
                                               pady=10)
            self.child_label13 = tkinter.Label(self.child_frame6,
                                               text=self.totalAmount,
                                               font=("", 12),
                                               pady=10)
            self.child_label16 = tkinter.Label(self.child_frame7,
                                               text="Date : ",
                                               font=("", 12),
                                               padx=100,
                                               pady=10)
            self.child_label17 = tkinter.Label(self.child_frame7,
                                               text=self.date,
                                               font=("", 12),
                                               pady=10)

            # Packing Labels
            self.child_label1.pack(side="left")
            # self.child_label14.pack(side="left")
            # self.child_label2.pack(side="left")
            # self.child_label3.pack(side="left")
            # self.child_label4.pack(side="left")
            self.child_label15.pack(side="left")
            self.child_label5.pack(side="left")
            self.child_label6.pack(side="left")
            self.child_label7.pack(side="left")
            self.child_label9.pack(side="right")
            self.child_label8.pack(side="right")
            self.child_label11.pack(side="right")
            self.child_label10.pack(side="right")
            self.child_label13.pack(side="right")
            self.child_label12.pack(side="right")
            self.child_label17.pack(side="right")
            self.child_label16.pack(side="right")

            # Packing frames
            self.child_frame1.pack()
            self.child_frame2.pack()
            self.child_frame3.pack()
            self.child_frame4.pack()
            self.child_frame5.pack()
            self.child_frame6.pack()
            self.child_frame7.pack()

            # self.main_window.destroy()
            # self.__init__()
            # self.prodNumList.clear()
            # self.prodUnitsList.clear()
            # self.prodPriceList.clear()
            # self.amountList.clear()
            # tkinter mainloop to keep the window running
            self.clear_content()
            tkinter.mainloop()
示例#37
0
            state["map"][x][y].update(sector)
            map_data[x][y].update(sector)
        if map_iterator:
            sum_of_beachhead_weights = 0
            for col in state["map"]:
                for sector in col:
                    if sector["beachhead_weight"] > 0:
                        sum_of_beachhead_weights += sector["beachhead_weight"]
            if sum_of_beachhead_weights > 0 and "invaders_per_turn" in state[
                    "rules"]:
                state["invaders_per_weight"] = state["rules"][
                    "invaders_per_turn"] // sum_of_beachhead_weights
            else:
                #prevent div by zero
                state["invaders_per_weight"] = 1


print("Starting interface")

try:
    quick_thread = threading.Thread(target=Clock.quick_update)
    update_thread = threading.Thread(target=update)
    force_update.set()
    quick_thread.start()
    update_thread.start()

    TK.mainloop()
except:
    pass
terminate = True
示例#38
0
 def run(self):
     tk.mainloop()
示例#39
0
    def plot_make(self):
        self.root = Tk.Tk()
        self.root.configure(background='white')
        self.root.wm_title('UBC Resistivity Measurement')
        fig1, ax1, ax2, ax3 = self._build_fig()
        plt_win = FigureCanvasTkAgg(fig1, master=self.root)

        #  plt_win.show()

        plt_win.get_tk_widget().grid(row=1, column=4, columnspan=6, rowspan=6)

        Tk.Label(master=self.root, text='Setpoint (K):',
                 background='white').grid(row=2, column=0)
        Tbox = Tk.Entry(master=self.root)
        Tbox.insert('end', '{:0.03f}'.format(4.2))
        Tbox.grid(row=2, column=1)

        Tk.Label(master=self.root,
                 text='Logging Interval (s):',
                 background='white').grid(row=3, column=0)
        Ibox = Tk.Entry(master=self.root)
        Ibox.insert('end', '{:d}'.format(5))
        Ibox.grid(row=3, column=1)

        Tk.Label(master=self.root, text='Direction',
                 background='white').grid(row=4, column=0)

        HC_opt = Tk.IntVar()
        HC_opt = 0

        Tk.Radiobutton(master=self.root,
                       text='Cool',
                       variable=HC_opt,
                       value=-1,
                       background='white').grid(row=4, column=1)
        Tk.Radiobutton(master=self.root,
                       text='Heat',
                       variable=HC_opt,
                       value=1,
                       background='white').grid(row=4, column=2)

        def _run():
            self.running = True
            self.root.after(1000 * int(Ibox.get()), task)
            run_button['state'] = 'disabled'
            stop_button['state'] = 'normal'

        def _stop():
            self.running = False
            self.root.after_cancel(self.recur_id)
            self.recur_id = None
            stop_button['state'] = 'disabled'
            run_button['state'] = 'normal'

        def _quit():
            self.lakeshore._disconnect()
            self.voltmeter._disconnect()
            self.lockin._disconnect()
            print('Devices Disconnected. Now exiting.')
            self.root.quit()
            self.root.destroy()

        def _save():
            self.fnm = filedialog.asksaveasfilename(
                initialdir="/",
                title="Select file",
                filetypes=(("text files", "*.txt"), ("all files", "*.*")))

            if self.fnm[-4:] != '.txt':
                self.fnm = self.fnm + '.txt'

            self.write_header()

        run_button = Tk.Button(master=self.root, text='START', command=_run)
        run_button.grid(row=5, column=0)

        stop_button = Tk.Button(master=self.root,
                                text='STOP',
                                state="disabled",
                                command=_stop)
        stop_button.grid(row=6, column=0)

        sv_button = Tk.Button(master=self.root, text='SAVE', command=_save)
        sv_button.grid(row=5, column=1)

        qt_button = Tk.Button(master=self.root, text='QUIT', command=_quit)
        qt_button.grid(row=5, column=2)

        Tk.Label(master=self.root,
                 text='Temperature (K):',
                 background='white',
                 fg='red').grid(row=7, column=0)
        Tk.Label(master=self.root,
                 text='Sample Resistance (Ohm):',
                 background='white',
                 fg='blue').grid(row=7, column=1)
        Tk.Label(master=self.root,
                 text='Reference Voltage (V):',
                 background='white',
                 fg='black').grid(row=7, column=2)
        Tk.Label(master=self.root, text='Time (s)',
                 background='white').grid(row=7, column=7)

        def task():
            T = self.lakeshore._measure_T()
            Vr = self.voltmeter._do_acv_measure()
            Vs_x, Vs_y = self.lockin._measure_V()
            Vs = Vs_x + 1.0j * Vs_y
            self._add_data(T, Vs, Vr)
            self.write_dataline(-1)
            self.update_figure(fig1, (ax1, ax2, ax3))
            self.recur_id = self.root.after(int(1000 * float(Ibox.get())),
                                            task)

        Tk.mainloop()
# Set up the GUI so that we can paint the fractal image on the screen
window = Tk()

canvas = Canvas(window, width=SIDE, height=SIDE, bg=BLACK)
canvas.pack()

# Paint the cell under the mouse cursor or left click (Button-1)
canvas.bind("<Button-1>", paintCell)

# Display the entire image on the screen upon right click (Button-3) or spacebar
canvas.bind("<Button-3>", paintEntireImage)
window.bind("<space>", paintEntireImage)

# Reset the image
window.bind("<r>", resetImage)
window.bind("<R>", resetImage)

# Display usage information
window.bind("<h>", usage)
window.bind("<H>", usage)

# Quit the program
window.bind("<Escape>", sys.exit)
window.bind("<q>", sys.exit)
window.bind("<Q>", sys.exit)

usage(None)

mainloop()
示例#41
0
scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
msg_list.pack(side=tkinter.LEFT, fill=tkinter.BOTH)
msg_list.pack()
messages_frame.pack()

entry_field = tkinter.Entry(top, textvariable=my_msg, width=75)
entry_field.bind("<Return>", send)
entry_field.pack()
send_button = tkinter.Button(top, text="Send", command=send)
send_button.pack()

top.protocol("WM_DELETE_WINDOW", on_closing)

#----Now comes the sockets part----
HOST = input('Enter host: ')
PORT = input('Enter port: ')
if not PORT:
    PORT = 33000
else:
    PORT = int(PORT)

BUFSIZ = 1024
ADDR = (HOST, PORT)

client_socket = socket(AF_INET, SOCK_STREAM)
client_socket.connect(ADDR)

receive_thread = Thread(target=receive)
receive_thread.start()
tkinter.mainloop()  # Starts GUI execution.
示例#42
0
def main():
    CI = CardInfo()
    try:
        tkinter.mainloop()
    except BaseException as e:
        logging.exception(e)
示例#43
0
    def __init__(self):
        self.main_window = tkinter.Tk()

        self.top_frame = tkinter.Frame(self.main_window)
        self.bottom_frame = tkinter.Frame(self.main_window)

        self.cb_var1 = tkinter.IntVar()
        self.cb_var2 = tkinter.IntVar()
        self.cb_var3 = tkinter.IntVar()
        self.cb_var4 = tkinter.IntVar()
        self.cb_var5 = tkinter.IntVar()
        self.cb_var6 = tkinter.IntVar()
        self.cb_var7 = tkinter.IntVar()

        self.cb_var1.set(0)
        self.cb_var2.set(0)
        self.cb_var3.set(0)
        self.cb_var4.set(0)
        self.cb_var5.set(0)
        self.cb_var6.set(0)
        self.cb_var7.set(0)

        self.cb1 = tkinter.Checkbutton(self.top_frame,
                                       text='Замена масла - $30.00',
                                       variable=self.cb_var1)
        self.cb2 = tkinter.Checkbutton(self.top_frame,
                                       text='Смазочные работы - $20.00',
                                       variable=self.cb_var2)
        self.cb3 = tkinter.Checkbutton(self.top_frame,
                                       text='Промывка радиатора - $40.00',
                                       variable=self.cb_var3)
        self.cb4 = tkinter.Checkbutton(
            self.top_frame,
            text='Замена жидкости в трансмиссии - $100.00',
            variable=self.cb_var4)
        self.cb5 = tkinter.Checkbutton(self.top_frame,
                                       text='Осмотр - $35.00',
                                       variable=self.cb_var5)
        self.cb6 = tkinter.Checkbutton(
            self.top_frame,
            text='Замена глушителя выхлопа - $200.00',
            variable=self.cb_var6)
        self.cb7 = tkinter.Checkbutton(self.top_frame,
                                       text='Перестановка шин - $20.00',
                                       variable=self.cb_var7)

        self.calc_button = tkinter.Button(self.bottom_frame,
                                          text='Показать стоимость',
                                          command=self.summary)
        self.quit_button = tkinter.Button(self.bottom_frame,
                                          text='Выйти',
                                          command=self.main_window.destroy)

        self.cb1.pack()
        self.cb2.pack()
        self.cb3.pack()
        self.cb4.pack()
        self.cb5.pack()
        self.cb6.pack()
        self.cb7.pack()

        self.calc_button.pack(side="left")
        self.quit_button.pack()

        self.top_frame.pack()
        self.bottom_frame.pack()

        tkinter.mainloop()
示例#44
0
def main():
    # These 4 lines just to prepare the window of the game, no need to change them
    root = tkinter.Tk()
    root.tobject1itle("Asteroids!")
    cv = ScrolledCanvas(root,600,600,600,600)
    cv.pack(side = tkinter.LEFT)

    #Here we prepre the new shapes of the game
    t = RawTurtle(cv)
    screen = t.getscreen()
    screen.setworldcoordinates(screenMinX,screenMinY,screenMaxX,screenMaxY)
    screen.register_shape("rock3",((-20, -16),(-21, 0), (-20,18),(0,27),(17,15),(25,0),(16,-15),(0,-21)))
    screen.register_shape("rock2",((-15, -10),(-16, 0), (-13,12),(0,19),(12,10),(20,0),(12,-10),(0,-13)))
    screen.register_shape("rock1",((-10,-5),(-12,0),(-8,8),(0,13),(8,6),(14,0),(12,0),(8,-6),(0,-7)))
    screen.register_shape("ship",((-10,-10),(0,-5),(10,-10),(0,10)))
    screen.register_shape("bullet",((-2,-4),(-2,4),(2,4),(2,-4)))
    screen.register_shape("monkey.gif")
    frame = tkinter.Frame(root)
    frame.pack(side = tkinter.RIGHT,fill=tkinter.BOTH)
    t.ht()
    
    # this function when it is called the game will exit
    def quitHandler():
        root.destroy()
        root.quit()

    #here we are creating the button that you will see it on the right side of the game called Quit
    # the part it says command=quitHandler is telling the button when we click it to run the function quitHandler that we defined above
    quitButton = tkinter.Button(frame, text = "Quit", command=quitHandler)
    quitButton.pack()
    
    screen.tracer(10)
    
    # here we are using the class we defined above to create the spaceShip
    ship = SpaceShip(cv,0,0,0,0)
    
    # This is preparing a list that we will store all the astroids in it
    asteroids = []
    
    # this loop runs 5 times and each time it creates an astroid and adds it to the list of astroids
    for k in range(5):
        # preparing random variables 
        dx = random.random() * 6 - 3 #random speed in x (change in x)
        dy = random.random() * 6 - 3 #random speed in y (change in y)
        x = random.random() * (screenMaxX - screenMinX) + screenMinX # random starting x location
        y = random.random() * (screenMaxY - screenMinY) + screenMinY # random starting y location
        size = random.random() * 3 +1 # random size (1 or 2 or 3) since we only defined 3 shapes of astroids

        # here we create the astroid with the random variables we defined above
        asteroid = Asteroid(cv,dx,dy,x,y,int(size))

        # here we are adding the astroid to the astroids list
        asteroids.append(asteroid)

    # here we a function that we will call it every 5 millisecond (THIS IS WHAT CODE KEEPS RUNNING WHILE THE GAME IS OPEN)
    # this we call it GAME LOOP
    # GAME LOOP (BEGIN)
    def play():
        # Tell all the elements of the game to move
        # Tell the ship to move
        ship.move()
        # go (loop) though each astroid in the astroids list and tell it to move as well check if it is toucing the ship
        for asteroid in asteroids:
            if (intersect(ship,asteroid)):
                print("You Failed")
                quitHandler()
            asteroid.move()
        # Set the timer to go off again in 5 milliseconds
        screen.ontimer(play, 5)
    # GAME LOOP (ENDS)

    # Set the timer to go off the first time in 5 milliseconds
    screen.ontimer(play,5)
    # this means call the defined function in class spaceShip turrnLeft for the ship everytime the left arrow key is pushed in the keyboard
    screen.onkeypress(ship.turnLeft,"Left")
    # this means call the defined function in class spaceShip turrnRight for the ship everytime the right arrow key is pushed in the keyboard
    screen.onkeypress(ship.turnRight,"Right")
    # this means call the defined function in class spaceShip turrnLeft for the ship everytime the up arrow key is pushed in the keyboard
    screen.onkeypress(ship.fireEngine,"Up")
    
    screen.listen()
    tkinter.mainloop()
示例#45
0
    def __init__(self,
                 chunk=3024,
                 frmat=pyaudio.paInt16,
                 channels=1,
                 rate=11025,
                 py=pyaudio.PyAudio()):

        # Start Tkinter and set Title
        self.main = tkinter.Tk()
        self.collections = []
        self.main.geometry("920x625+500+150")
        self.main.title("Numbers prediction")
        self.CHUNK = chunk
        self.FORMAT = frmat
        self.CHANNELS = channels
        self.RATE = rate
        self.p = py
        self.frames = []
        self.st = 0
        self.stream = self.p.open(format=self.FORMAT,
                                  channels=self.CHANNELS,
                                  rate=self.RATE,
                                  input=True,
                                  frames_per_buffer=self.CHUNK)

        # Set Frames
        self.buttons = tkinter.Frame(self.main, padx=120, pady=20)

        self.labAudio = tkinter.Label(self.main,
                                      text="Audio prediction",
                                      font="Arial 14")
        self.labAudio.place(x=5, y=5)

        self.butRecord = tkinter.Button(self.main,
                                        width=11,
                                        height=1,
                                        command=lambda: self.toggleRecord(),
                                        text="Start recording",
                                        bg=misc.green,
                                        fg=misc.black)
        self.butRecord.place(x=10, y=35)

        self.butGraph = tkinter.Button(self.main,
                                       width=7,
                                       height=1,
                                       command=lambda: self.doGraphics(),
                                       text="Graph audio",
                                       bg=misc.hardBlue,
                                       fg=misc.black)
        self.butGraph.place(x=145, y=35)

        self.butPredict = tkinter.Button(self.main,
                                         width=7,
                                         height=1,
                                         command=lambda: self.doPrediction(),
                                         text="Predict",
                                         bg=misc.hardBlue,
                                         fg=misc.black)
        self.butPredict.place(x=243, y=35)

        self.butClear = tkinter.Button(self.main,
                                       width=7,
                                       height=1,
                                       command=lambda: self.cleanCanvas(),
                                       text="Clear",
                                       bg=misc.hardBlue,
                                       fg=misc.black)
        self.butClear.place(x=340, y=35)

        self.audioPathEntry = tkinter.Entry(self.main, bg="#FFFFFF", width=55)
        self.audioPathEntry.bind("<Key>", lambda e: "break")
        self.audioPathEntry.place(x=10, y=75)

        img_search = misc.load_img("dir_search.png")
        b_dir = tkinter.Button(self.main,
                               justify=tkinter.LEFT,
                               image=img_search,
                               command=lambda: self.askAudioFilePath())
        b_dir.photo = img_search
        b_dir.place(x=520, y=70)

        self.butClear = tkinter.Button(self.main,
                                       width=7,
                                       height=1,
                                       command=lambda: self.loadNewAudio(),
                                       text="Load",
                                       bg=misc.hardBlue,
                                       fg=misc.black)
        self.butClear.place(x=560, y=70)

        #-----
        self.predGroup = tkinter.LabelFrame(self.main,
                                            text="Prediction",
                                            width=200,
                                            height=200)
        self.predGroup.place(x=700, y=110)

        self.labTxtPrediction = tkinter.Label(self.predGroup,
                                              text="The audio contains a:",
                                              font="Arial 14")
        self.labTxtPrediction.place(x=5, y=5)

        self.labTxtPrediction = tkinter.Label(self.predGroup,
                                              text="00",
                                              font="Arial 72")
        self.labTxtPrediction.place(x=45, y=45)

        #-----
        self.predGroup = tkinter.LabelFrame(self.main,
                                            text="Audio adjust",
                                            width=200,
                                            height=200)
        self.predGroup.place(x=700, y=325)

        self.butCrop = tkinter.Button(self.predGroup,
                                      width=7,
                                      height=1,
                                      command=lambda: self.cropAudio(),
                                      text="Crop",
                                      bg=misc.hardBlue,
                                      fg=misc.black)
        self.butCrop.place(x=5, y=5)

        self.butCrop = tkinter.Button(self.predGroup,
                                      width=7,
                                      height=1,
                                      command=lambda: self.playAudio(),
                                      text="Play",
                                      bg=misc.hardBlue,
                                      fg=misc.black)
        self.butCrop.place(x=100, y=5)

        self.initLabel = tkinter.Label(self.predGroup, text="Init time:")
        self.initLabel.place(x=5, y=45)

        self.initEntry = tkinter.Entry(self.predGroup, bg="#FFFFFF")
        self.initEntry.place(x=5, y=65)

        self.endLabel = tkinter.Label(self.predGroup, text="End time:")
        self.endLabel.place(x=5, y=95)

        self.endEntry = tkinter.Entry(self.predGroup, bg="#FFFFFF")
        self.endEntry.place(x=5, y=115)

        #-----
        self.graphGroup = tkinter.LabelFrame(self.main,
                                             text="Audio graphics",
                                             width=650,
                                             height=510)
        self.graphGroup.place(x=5, y=110)

        #self.canvas = tkinter.Canvas(window, width=300, height=300)

        tkinter.mainloop()
示例#46
0
def formulaire_marc2tables(master,
                           access_to_network=True,
                           last_version=[version, False]):
    # =============================================================================
    # Structure du formulaire - Cadres
    # =============================================================================
    couleur_fond = "white"
    couleur_bouton = "#2D4991"
    #couleur_bouton = "#99182D"

    [
        form, zone_alert_explications, zone_access2programs, zone_actions,
        zone_ok_help_cancel, zone_notes
    ] = main.form_generic_frames(
        master, "Conversion de fichiers de notices MARC en tableaux",
        couleur_fond, couleur_bouton, access_to_network)

    cadre_input = tk.Frame(zone_actions,
                           highlightthickness=2,
                           highlightbackground=couleur_bouton,
                           relief="groove",
                           height=150,
                           padx=10,
                           bg=couleur_fond)
    cadre_input.pack(side="left", anchor="w")
    cadre_input_header = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_header.pack(anchor="w")
    cadre_input_file = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_file.pack(anchor="w")
    cadre_input_file_name = tk.Frame(cadre_input_file, bg=couleur_fond)
    cadre_input_file_name.pack(side="left")
    cadre_input_file_browse = tk.Frame(cadre_input_file, bg=couleur_fond)
    cadre_input_file_browse.pack(side="left")
    cadre_input_infos_format = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_infos_format.pack(side="left")

    cadre_input_type_docs_interstice1 = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_type_docs_interstice1.pack(side="left")

    cadre_input_type_docs = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_type_docs.pack(side="left")
    cadre_input_type_docs_interstice2 = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_type_docs_interstice2.pack(side="left")
    cadre_input_type_rec = tk.Frame(cadre_input, bg=couleur_fond)
    cadre_input_type_rec.pack(side="left")

    cadre_inter = tk.Frame(zone_actions,
                           borderwidth=0,
                           padx=10,
                           bg=couleur_fond)
    cadre_inter.pack(side="left")
    tk.Label(cadre_inter, text=" ", bg=couleur_fond).pack()

    #=============================================================================
    #     Formulaire - Fichier en entrée
    # =============================================================================

    cadre_output = tk.Frame(zone_actions,
                            highlightthickness=2,
                            highlightbackground=couleur_bouton,
                            relief="groove",
                            height=150,
                            padx=10,
                            bg=couleur_fond)
    cadre_output.pack(side="left")
    cadre_output_header = tk.Frame(cadre_output, bg=couleur_fond)
    cadre_output_header.pack(anchor="w")
    cadre_output_nom_fichiers = tk.Frame(cadre_output, bg=couleur_fond)
    cadre_output_nom_fichiers.pack(anchor="w")
    cadre_output_repertoire = tk.Frame(cadre_output, bg=couleur_fond)
    cadre_output_repertoire.pack(anchor="w")
    cadre_output_explications = tk.Frame(cadre_output,
                                         padx=20,
                                         bg=couleur_fond)
    cadre_output_explications.pack(anchor="w")

    cadre_output_message_en_cours = tk.Frame(cadre_output,
                                             padx=20,
                                             bg=couleur_fond)
    cadre_output_message_en_cours.pack(anchor="w")

    cadre_valider = tk.Frame(zone_ok_help_cancel,
                             borderwidth=0,
                             relief="groove",
                             height=150,
                             padx=10,
                             bg=couleur_fond)
    cadre_valider.pack(side="left")

    #définition input URL (u)
    tk.Label(cadre_input_header,
             bg=couleur_fond,
             fg=couleur_bouton,
             text="En entrée :",
             justify="left",
             font="bold").pack(anchor="w")

    tk.Label(cadre_input_file_name,
             bg=couleur_fond,
             text="Fichier contenant les notices : ").pack(side="left")
    """entry_filename = tk.Entry(cadre_input_file, width=40, bd=2)
    entry_filename.pack(side="left")
    entry_filename.focus_set()"""
    main.download_zone(cadre_input_file,
                       "Sélectionner un fichier\nde notices Marc",
                       entry_file_list, couleur_fond,
                       cadre_output_message_en_cours)

    #tk.Button(cadre_input_file_browse, text="Sélectionner le fichier\ncontenant les notices", command=lambda:main.openfile(cadre_input_file_name, popup_filename), width=20).pack()
    """tk.Label(cadre_input_infos_format,bg=couleur_fond, text="Format MARC", 
             anchor="w", justify="left").pack(anchor="w")
    marc_format = tk.IntVar()

    bib2ark.radioButton_lienExample(cadre_input_infos_format,marc_format,1,couleur_fond,
                            "Unimarc",
                            "",
                            "")

    tk.Radiobutton(cadre_input_infos_format,bg=couleur_fond, text="Marc21", variable=marc_format, value=2,
                   anchor="w", justify="left").pack(anchor="w")
    marc_format.set(1)"""

    tk.Label(cadre_input_type_docs_interstice1,
             bg=couleur_fond,
             text="\t\t",
             justify="left").pack()

    tk.Label(cadre_input_type_docs,
             bg=couleur_fond,
             text="Format de fichier",
             anchor="w",
             justify="left",
             font="Arial 9 bold").pack(anchor="w")
    file_format = tk.IntVar()

    bib2ark.radioButton_lienExample(
        cadre_input_type_docs, file_format, 1, couleur_fond, "iso2709", "",
        "https://github.com/Transition-bibliographique/alignements-donnees-bnf/blob/master/examples/noticesbib.iso"
    )

    tk.Radiobutton(cadre_input_type_docs,
                   bg=couleur_fond,
                   text="Marc XML",
                   variable=file_format,
                   value=2,
                   anchor="w",
                   justify="left").pack(anchor="w")
    file_format.set(1)
    info_utf8 = tk.Label(cadre_input_type_docs,
                         bg=couleur_fond,
                         justify="left",
                         font="Arial 7 italic",
                         text="""Le fichier iso2709 doit être 
en UTF-8 sans BOM.             
En cas de problème, 
convertissez-le en XML
avant de le passer dans ce module




""")
    info_utf8.pack()

    tk.Label(cadre_input_type_docs_interstice2,
             bg=couleur_fond,
             text="\t",
             justify="left").pack()

    tk.Label(cadre_input_type_rec,
             bg=couleur_fond,
             text="\nType de notices",
             anchor="w",
             justify="left",
             font="Arial 9 bold").pack(anchor="w")
    rec_format = tk.IntVar()

    bib2ark.radioButton_lienExample(cadre_input_type_rec, rec_format, 1,
                                    couleur_fond, "bibliographiques", "", "")

    tk.Radiobutton(cadre_input_type_rec,
                   bg=couleur_fond,
                   text="autorités (personnes)",
                   variable=rec_format,
                   value=2,
                   anchor="w",
                   justify="left").pack(anchor="w")
    rec_format.set(1)

    tk.Label(cadre_input_type_rec, text="\n\n\n\n", bg=couleur_fond).pack()

    # =============================================================================
    #     Formulaire - Fichiers en sortie
    # =============================================================================
    #

    #Choix du format
    tk.Label(cadre_output_header,
             bg=couleur_fond,
             fg=couleur_bouton,
             font="bold",
             text="En sortie :",
             justify="left").pack()
    tk.Label(cadre_output_nom_fichiers,
             bg=couleur_fond,
             text="Identifiant des fichiers en sortie : ",
             justify="left").pack(side="left")
    output_ID = tk.Entry(cadre_output_nom_fichiers, width=40, bd=2)
    output_ID.pack(side="left")

    #Sélection du répertoire en sortie
    #tk.Label(cadre_output_repertoire,text="\n",bg=couleur_fond).pack()
    #main.select_directory(cadre_output_repertoire, "Dossier où déposer les fichiers",output_directory_list,couleur_fond)

    #Ajout (optionnel) d'un identifiant de traitement
    message_fichiers_en_sortie = """
  Le programme va générer plusieurs fichiers, par type de document,
  en fonction du processus d'alignement avec les données de la BnF
  et des métadonnées utilisées pour cela :
        - monographies imprimées
        - périodiques
        - audiovisuel (CD/DVD)
        - autres non identifiés

        
  Pour faire cela, il utilise les informations 
  en zones codées dans chaque notice Unimarc
"""
    tk.Label(cadre_output_explications,
             bg=couleur_fond,
             text=message_fichiers_en_sortie,
             justify="left").pack()
    #explications.pack()

    #Bouton de validation

    b = tk.Button(
        cadre_valider,
        bg=couleur_bouton,
        fg="white",
        font="bold",
        text="OK",
        command=lambda: launch(form, entry_file_list[0], file_format.get(),
                               rec_format.get(), output_ID.get(), master),
        borderwidth=5,
        padx=10,
        pady=10,
        width=10,
        height=4)
    b.pack()

    tk.Label(cadre_valider, font="bold", text="", bg=couleur_fond).pack()

    call4help = tk.Button(
        cadre_valider,
        text="Besoin d'aide ?",
        command=lambda: main.click2openurl(
            "https://github.com/Transition-bibliographique/alignements-donnees-bnf/"
        ),
        padx=10,
        pady=1,
        width=15)
    call4help.pack()

    cancel = tk.Button(cadre_valider,
                       bg=couleur_fond,
                       text="Annuler",
                       command=lambda: main.annuler(form),
                       padx=10,
                       pady=1,
                       width=15)
    cancel.pack()

    tk.Label(zone_notes,
             text="Version " + str(main.version) + " - " + lastupdate,
             bg=couleur_fond).pack()
    """if (main.last_version[1] == True):
        download_update = tk.Button(zone_notes, text = "Télécharger la version " + str(main.last_version[0]), command=download_last_update)
        download_update.pack()"""

    tk.mainloop()
示例#47
0
def main(args):
	Tk.mainloop()
示例#48
0
    def __init__(self):
        #Set the main window properties.
        self.main = tkinter.Tk()
        self.main.geometry('500x500+400+100')
        self.main.title("WordChain Log Viewer")

        try:
            self.logs = open('logs.txt', 'r')
            self.logsData = json.load(self.logs)
            self.logs.close()
        except Exception:
            self.error = tkinter.messagebox.showerror(
                "Error",
                "File either don't exist or does not contain any Json data.")
            self.main.destroy()
            return

        #Specify which index and then you can later use this self.nextLog to specify which list index
        #you want to retrieve.
        self.nextLog = 0

        #Set frames
        self.logFrame = tkinter.Frame()
        self.playerFrame = tkinter.Frame()
        self.chainFrame = tkinter.Frame()
        self.buttonFrame = tkinter.Frame()

        #1. logFrame (top frame)
        self.logLabel = tkinter.Label(self.logFrame, text='Log #:')
        self.logNumDisplay = tkinter.Label(self.logFrame, text=self.nextLog)

        self.logLabel.pack(side='left')
        self.logNumDisplay.pack(side='left')

        #2. playerFrame (middle-upper frame)
        self.playerLabel = tkinter.Label(self.playerFrame, text="Players:")
        self.numPlayersDisplay = tkinter.Label(self.playerFrame, text='')

        self.playerLabel.pack(side='left')
        self.numPlayersDisplay.pack(side='left')

        #3. chainFrame (middle-lower frame)
        self.chainLabel = tkinter.Label(self.chainFrame, text="Chain Length:")
        self.numChainsDisplay = tkinter.Label(self.chainFrame, text='')

        self.chainLabel.pack(side='left')
        self.numChainsDisplay.pack(side='left')

        #4. buttonFrame (bottom frame)
        self.nextButton = tkinter.Button(self.buttonFrame,
                                         text='Next Log',
                                         command=self.showLog,
                                         width=15,
                                         height=3)
        self.showButton = tkinter.Button(self.buttonFrame,
                                         text='Show Stats',
                                         command=self.showStats,
                                         width=15,
                                         height=3)

        self.nextButton.pack(side='left')
        self.showButton.pack(side='left')

        #Set the "packs" frames.
        self.logFrame.pack()
        self.playerFrame.pack()
        self.chainFrame.pack()
        self.buttonFrame.pack()

        self.showLog()
        tkinter.mainloop()
def addMiddleIndicator(what):
    global middleIndicator
    global DatCounter

    if DataPace == "tick":
        popupmsg("Indicators in Tick Data not available.")

    if what != "none":
        if middleIndicator == "none":
            if what == "sma":
                midIQ = tk.Tk()
                midIQ.wm_title("Periods?")
                label = ttk.Label(midIQ, text="Choose how many periods you want your SMA to be.")
                label.pack(side="top", fill="x", pady=10)
                e = ttk.Entry(midIQ)
                e.insert(0,10)
                e.pack()
                e.focus_set()

                def callback():
                    global middleIndicator
                    global DatCounter

                    middleIndicator = []
                    periods = (e.get())
                    group = []
                    group.append("sma")
                    group.append(int(periods))
                    middleIndicator.append(group)
                    DatCounter = 9000
                    print("middle indicator set to:",middleIndicator)
                    midIQ.destroy()

                b = ttk.Button(midIQ, text="Submit", width=10, command=callback)
                b.pack()
                tk.mainloop()

            if what == "ema":
                midIQ = tk.Tk()
                #midIQ.wm_title("Periods?")
                label = ttk.Label(midIQ, text="Choose how many periods you want your EMA to be.")
                label.pack(side="top", fill="x", pady=10)
                e = ttk.Entry(midIQ)
                e.insert(0,10)
                e.pack()
                e.focus_set()

                def callback():
                    global middleIndicator
                    global DatCounter

                    middleIndicator = []
                    periods = (e.get())
                    group = []
                    group.append("ema")
                    group.append(int(periods))
                    middleIndicator.append(group)
                    DatCounter = 9000
                    print("middle indicator set to:",middleIndicator)
                    midIQ.destroy()

                b = ttk.Button(midIQ, text="Submit", width=10, command=callback)
                b.pack()
                tk.mainloop()
                
        else:
            if what == "sma":
                midIQ = tk.Tk()
                midIQ.wm_title("Periods?")
                label = ttk.Label(midIQ, text="Choose how many periods you want your SMA to be.")
                label.pack(side="top", fill="x", pady=10)
                e = ttk.Entry(midIQ)
                e.insert(0,10)
                e.pack()
                e.focus_set()

                def callback():
                    global middleIndicator
                    global DatCounter

                    #middleIndicator = []
                    periods = (e.get())
                    group = []
                    group.append("sma")
                    group.append(int(periods))
                    middleIndicator.append(group)
                    DatCounter = 9000
                    print("middle indicator set to:",middleIndicator)
                    midIQ.destroy()

                b = ttk.Button(midIQ, text="Submit", width=10, command=callback)
                b.pack()
                tk.mainloop()



                
            if what == "ema":
                midIQ = tk.Tk()
                midIQ.wm_title("Periods?")
                label = ttk.Label(midIQ, text="Choose how many periods you want your EMA to be.")
                label.pack(side="top", fill="x", pady=10)
                e = ttk.Entry(midIQ)
                e.insert(0,10)
                e.pack()
                e.focus_set()

                def callback():
                    global middleIndicator
                    global DatCounter

                    #middleIndicator = []
                    periods = (e.get())
                    group = []
                    group.append("ema")
                    group.append(int(periods))
                    middleIndicator.append(group)
                    DatCounter = 9000
                    print("middle indicator set to:",middleIndicator)
                    midIQ.destroy()

                b = ttk.Button(midIQ, text="Submit", width=10, command=callback)
                b.pack()
                tk.mainloop()

    else:
        middleIndicator = "none"
示例#50
0
 def go(self):
   self.update(0, (0, self.width, 0, self.height))
   tk.mainloop()
def locate_wells(plate, img_types, workingDir, new_pixel_width,
                 output_file_name):
    import tkinter as Tk
    from PIL import Image, ImageTk
    import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib.pyplot import imshow, annotate, savefig, close

    # gets all images
    fileList = GenerateFileList(directory=workingDir,
                                regex=".*" + img_types[plate])
    fileList = sorted(fileList)

    root = Tk.Tk()
    well_locs = {}  # dictionary of pixel locations for each well

    # imports image and resizes it
    image = Image.open(workingDir + '/' + fileList[0])
    width, height = image.size
    control_panel_width = 400
    wall_offset = 100
    scaling = new_pixel_width / width
    new_height = int(scaling * height)
    image = image.resize((new_pixel_width, new_height))

    mode = 0  # mode 0 means no locations defined, 1 means A1 defined, 2 means both are defined
    first_well_x = 0
    first_well_y = 0
    last_well_x = 0
    last_well_y = 0
    crs = 4  # radius in pixels for circles drawn on the plate
    row_num = 8
    col_num = 12
    radius = 1
    spacing = 0
    shapes = []  # keeps track of all the shapes drawn on canvas

    canvas = Tk.Canvas(root,
                       width=new_pixel_width + control_panel_width,
                       height=new_height)

    # Undoes last well location defined
    def undo_well_click():
        nonlocal mode
        if mode == 1:  # gets rid of first well definition
            canvas.delete(shapes.pop())
            mode -= 1
        elif mode == 2:  # gets rid of second well definition
            while len(shapes) > 1:
                canvas.delete(shapes.pop())
            mode -= 1

    # If well locations have been defined, plots where every well is
    def test_wells_on_click():
        nonlocal row_num
        nonlocal col_num
        nonlocal radius
        nonlocal spacing
        if mode == 2:
            row_num = int(row_entry.get())
            col_num = int(column_entry.get())
            w0 = abs(first_well_x - last_well_x)
            h0 = abs(first_well_y - last_well_y)
            spacing = h0 * col_num / (row_num - 1) - w0
            radius = (w0 - spacing * (col_num - 1)) / 2 / col_num
            x_dir = 1
            y_dir = 1
            if first_well_x > last_well_x:
                x_dir = -1
            if first_well_y > last_well_y:
                y_dir = -1
            for r in range(1, row_num + 1):
                for c in range(1, col_num + 1):
                    dr = radius / 2
                    x = first_well_x + x_dir * ((c - 1) * spacing +
                                                (2 * c - 1) * radius)
                    y = first_well_y + y_dir * ((r - 1) * spacing +
                                                (2 * r - 2) * radius)
                    shapes.append(
                        canvas.create_oval(x - dr, y - dr, x + dr, y + dr))
                    well_locs[get_well_id(r, c)] = np.array([x, y]) / scaling

    # saves the scaled and annotated image, exits window and moves on in the function
    def approve_wells_on_click():
        for file in fileList[0:1]:  # for now will only do this for one
            new_image = Image.open(workingDir + '/' + file)
            new_image = new_image.resize((new_pixel_width, new_height))
            if mode == 2:
                imshow(new_image)
                for r in range(1, row_num + 1):
                    for c in range(1, col_num + 1):
                        annotate(s=get_well_id(r, c),
                                 xy=well_locs[get_well_id(r, c)] * scaling)
                print(output_file_name, file)
                save_spot = output_file_name[:len(output_file_name) -
                                             4] + file[:len(file) -
                                                       4] + output_file_name[
                                                           len(output_file_name
                                                               ) - 4:]
                savefig(save_spot)
                close()
        root.quit()
        root.destroy()

    # defines known locations on the plate
    def click_plate(event):
        nonlocal mode
        nonlocal first_well_x
        nonlocal first_well_y
        nonlocal last_well_x
        nonlocal last_well_y
        if mode == 0:
            shapes.append(
                canvas.create_oval(event.x - crs,
                                   event.y - crs,
                                   event.x + crs,
                                   event.y + crs,
                                   fill='blue'))
            first_well_x = event.x
            first_well_y = event.y
            mode += 1

        elif mode == 1:
            shapes.append(
                canvas.create_oval(event.x - crs,
                                   event.y - crs,
                                   event.x + crs,
                                   event.y + crs,
                                   fill='green'))
            last_well_x = event.x
            last_well_y = event.y
            mode += 1
        elif mode == 2 and len(shapes) > 2:
            # gets row and column number of well pressed
            column = int(
                np.floor(abs(event.x - first_well_x) /
                         (2 * radius + spacing))) + 1
            row = int(
                np.floor(abs(event.y - first_well_y) /
                         (2 * radius + spacing))) + 1
            if column <= col_num and row <= row_num and column > 0 and row > 0:
                loc = well_locs[get_well_id(row, column)] * scaling
                red_pixels, green_pixels, blue_pixels = get_pixels(
                    image.load(), int(loc[0]), int(loc[1]), int(radius / 2))
                plt.figure()
                plt.hist(red_pixels)
                plt.hist(green_pixels)
                plt.hist(blue_pixels)
                plt.show()

    plate = ImageTk.PhotoImage(image, master=canvas)
    canvas.create_image(new_pixel_width / 2, new_height / 2, image=plate)
    canvas.bind("<Button-1>", click_plate)
    canvas.pack()

    leftx = (new_pixel_width + wall_offset) / (new_pixel_width +
                                               control_panel_width)

    Tk.Label(canvas, text="Enter Row #").place(relx=leftx, rely=0.1)
    row_entry = Tk.Entry(canvas)
    row_entry.place(relx=leftx, rely=0.2)
    row_entry.insert(0, '8')
    Tk.Label(canvas, text="Enter Col #").place(relx=leftx, rely=0.3)
    column_entry = Tk.Entry(canvas)
    column_entry.place(relx=leftx, rely=0.4)
    column_entry.insert(0, '12')
    undo_wells = Tk.Button(canvas,
                           text="Undo Well Define",
                           command=undo_well_click)
    undo_wells.place(relx=leftx, rely=0.5)
    test_wells = Tk.Button(canvas,
                           text="Test Well Locations",
                           command=test_wells_on_click)
    test_wells.place(relx=leftx, rely=0.6)
    approve_wells = Tk.Button(canvas,
                              text="Approve Well Locations",
                              command=approve_wells_on_click)
    approve_wells.place(relx=leftx, rely=0.7)

    Tk.mainloop()

    return well_locs, radius / scaling
示例#52
0
        meter_publish(msg)
        last_value = value
    producer.process_data_events()
    root.after(1000, meter_reading)


#mark start
meter_publish({
    'id': meter_id,
    'ts': time.time(),
    'value': 0,
    'state': State.ONLINE
})

#start poll
root.after(1100, meter_reading)

root.protocol('WM_DELETE_WINDOW', lambda: root.quit())
tk.mainloop()  # GUI mainloop

#mark stop
meter_publish({
    'id': meter_id,
    'ts': time.time() + 1,
    'value': 0,
    'state': State.OFFLINE
})

# cleanup
producer.close()
示例#53
0
)  #Prevents the user from typing directly into the chat history

userInputFrame = tk.Frame(
    window)  #Creates a frame to hold the widgets related to user input
userInputFrame.configure(background="cornflower blue")

userInput = tk.Entry(userInputFrame,
                     width=75)  #Adds a text entry widget to the frame
userInput.grid(row=0, column=0, ipady=3, padx=2)
userInput.bind(
    "<Return>", sendMessage
)  #Binds the return key to the widget so that it calls the sendMessage function when the key is pressed

sendBtn = tk.Button(
    userInputFrame, text="Send Message", command=sendMessage
)  #Adds a button widget that sends the message found in the entry widget to the server
sendBtn.grid(row=0, column=1)
userInputFrame.pack(
    pady=15
)  #Adds the frame and its contents to the GUI so it is displayed with the rest of the elements
#GUI End

receiveMessage(i)  #Receives the initial message from the chatbot
i = i + 1  #Used to prevent global variable username being reset after initial declaration

tk.mainloop()  #Runs the GUI

#Close Socket
thisSocket.close()
print("Conversation between user and ChatBot Ended")
示例#54
0
def main():
    # Создать элемент интерфейса главного окна.
    main_window = tkinter.Tk()

    # Войти в главный цикл tkinter.
    tkinter.mainloop()
alluser_button = tkinter.Button(top, text="Select User(s)", command=allusers)                                              # alluser button used to trigger the function alluser to get the list all users from the server and display the username selection window depending on the messaging option selected
alluser_button.pack()                                                                                                   # packing the alluser button onto the main gui frame

message_to_send_button = tkinter.Button(top, text="Send Message to User(s)", command=message_to_send)                   # message_to_send_button used to trigger the function meesage to send - which prompts the user to enter a piece of message for the intended recipients
message_to_send_button.pack()                                                                                           # packing the message to send button onto the main gui frame

check_my_messages_button = tkinter.Button(top, text="Check Messages", command=check_my_messages)                        # check_my_messages_button used to trigger the function check_my_messages - which sends a request to the server to send any messages available for this client
check_my_messages_button.pack()                                                                                         # packing the message to send button onto the main gui frame



################################################################################################################################################################################################################
""" SOCKET Setup"""
################################################################################################################################################################################################################3


host = "127.0.0.1"                                                              # host IP address for the client to connect to
port = 12345                                                                    # host port number to communicate with the server
BUFSIZ = 1024                                                                   # buffer to temporarily store msgs from the server
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)                      # creating a client socket object
client.connect((host, port))                                                    # Trying to establish connection with the server using the above mentioned credentials
connect_thread = Thread(target=connect)                                         # initializing a thread to connect with the server and register a username
connect_thread.start()                                                          # starting the above mentioned thread
tkinter.mainloop()                                                              # Starts client GUI module as main loop



################################################################################################################################################################################################################
""" END OF CLIENT CODE"""
################################################################################################################################################################################################################3
示例#56
0
def main():
    root = tk.Tk()
    base = Display(root)

    tk.mainloop()
    def __init__(self, rows):
        # Main window definition
        self.main_window = tkinter.Tk()
        self.main_window.title("Restaurant Browser")
        self.main_window.geometry('500x500')
        self.main_window.resizable(width="true", height="true")

        # Variables for search button and search value
        self.selected_column = 'Name'  # variable that contains the user-selected column; initially set to 'Name'
        self.search_button_text = tkinter.StringVar(
        )  # variable that contains text for the search button
        self.search_button_text.set(
            'Search by Name')  # initial text for the search button
        self.search_value = tkinter.StringVar(
        )  # variable that contains user-provided search value

        # Widgets for row 0 of the grid layout: Label, Button, and Entry field
        tkinter.Label(self.main_window,
                      text='Restaurant Browser').grid(row=0, column=0)
        tkinter.Button(self.main_window,
                       textvariable=self.search_button_text,
                       command=self.search_db,
                       fg=fgcolor,
                       bg=bgcolor).grid(row=0, column=2)
        self.search_value_entry = tkinter.Entry(
            self.main_window, width=15,
            textvariable=self.search_value).grid(row=0, column=3)

        #Create a list to store previous records
        self.list = []
        # Each Restaurant column header is represented by a Button widget.
        # When one of these buttons is clicked, the select_column function is called
        #   with an argument value equal to the column name (Name, City, State, or Cuisine)
        try:
            r = 1
            cols = ['Name', 'City', 'State', 'Cuisine']
            tkinter.Button(self.main_window,
                           text=cols[0],
                           command=lambda: self.select_column(cols[0]),
                           fg=fgcolor,
                           bg=bgcolor,
                           padx=pad,
                           font=label_font).grid(row=r,
                                                 column=0,
                                                 sticky=tkinter.constants.W)
            tkinter.Button(self.main_window,
                           text=cols[1],
                           command=lambda: self.select_column(cols[1]),
                           fg=fgcolor,
                           bg=bgcolor,
                           padx=pad,
                           font=label_font).grid(row=r,
                                                 column=1,
                                                 sticky=tkinter.constants.W)
            tkinter.Button(self.main_window,
                           text=cols[2],
                           command=lambda: self.select_column(cols[2]),
                           fg=fgcolor,
                           bg=bgcolor,
                           padx=pad,
                           font=label_font).grid(row=r,
                                                 column=2,
                                                 sticky=tkinter.constants.W)
            tkinter.Button(self.main_window,
                           text=cols[3],
                           command=lambda: self.select_column(cols[3]),
                           fg=fgcolor,
                           bg=bgcolor,
                           padx=pad,
                           font=label_font).grid(row=r,
                                                 column=3,
                                                 sticky=tkinter.constants.W)
            self.display_rows(
                rows
            )  # Displays all restaurant data when the GUI is initially displayed
            tkinter.mainloop()
        except IndexError as err:
            print('Index error: ', err)
        except Exception as err:
            print('An error occurred: ', err)
示例#58
0
    "92.10.10.15", "92.10.10.20", "92.10.10.25", "01.05.10.15", "01.05.10.20",
    "01.05.10.30"
]

variable = tkt.StringVar()
#we set the default ip
variable.set(OptionList[0])

#option menu
opt = tkt.OptionMenu(window, variable, *OptionList)
#we integrate it into the packet
opt.pack()

#input field, tying it to the string variable
entry_field = tkt.Entry(window, textvariable=my_msg)
#we tie the chat_send function to the return key
entry_field.bind("<Return>", chat_send)

entry_field.pack()
#send button, connecting it to the chat_send function
send_button = tkt.Button(window, text="Enter", command=chat_send)
#we integrate the key to the packet
send_button.pack()

window.protocol("WM_DELETE_WINDOW", on_closing)

#the thread starts once the connection is estabilished and the GUI appears
receive_thread = Thread(target=join, daemon=False)
receive_thread.start()
tkt.mainloop()
    def __init__(self):
        self.bnksys_obj = BankSystem()
        self.window = tk.Tk()
        self.window.wm_iconbitmap('BCU.ico')
        self.window.geometry("400x300")
        self.window.title("Welcom to BCU Bank System")
        self.window.after(1, lambda: self.window.focus_force())
        self.window.resizable(width=False, height=False)

        fname = "index.png"
        bg_image = tk.PhotoImage(file=fname)
        tk.Canvas()
        cv = tk.Canvas(width=400, heigh=400)
        cv.pack(side='top', fill='both', expand='yes')
        cv.create_image(12, 30, image=bg_image, anchor='nw')

        self.lblUserName = tk.Label(self.window,
                                    text="User name:",
                                    font=("Helvetica", 10))
        self.txtUserName = tk.Entry(self.window,
                                    width=14,
                                    font=("Helvetica", 12))
        self.lblPassword = tk.Label(self.window,
                                    text="Password:"******"Helvetica", 10))
        self.txtPassword = tk.Entry(self.window,
                                    width=14,
                                    font=("Helvetica", 12),
                                    show='*')
        self.btnLogin = tk.Button(self.window,
                                  text="Login",
                                  width=15,
                                  height=3,
                                  command=self.callAdminMenu,
                                  font=("Calibri Light (Headings)", 10))
        self.lblCopyRight = tk.Label(
            self.window,
            text="Copyright © Basaad, Birmingham City University 2018 ",
            font=("Bodoni MT Condensed", 10))

        self.lblUserName.place(x=250, y=50)
        self.txtUserName.place(x=250, y=70)
        self.lblPassword.place(x=250, y=100)
        self.txtPassword.place(x=250, y=120)
        self.btnLogin.place(x=(self.window.winfo_width() / 2) + 50, y=195)
        self.lblCopyRight.place(x=8, y=275)

        self.btnLogin.bind("<Enter>",
                           lambda event, h=self.btnLogin: h.configure(
                               bg="#00104E", fg="white"))
        self.btnLogin.bind("<Leave>",
                           lambda event, h=self.btnLogin: h.configure(
                               bg="SystemButtonFace", fg="Black"))

        entries = [
            child for child in self.window.winfo_children()
            if isinstance(child, tk.Entry) or isinstance(child, tk.Button)
        ]
        for idx, entry in enumerate(entries):
            entry.bind('<Return>',
                       lambda e, idx=idx: self.bnksys_obj.go_to_next_entry(
                           e, entries, idx))

        self.bnksys_obj.uploadAdminsInfo()
        self.uploadCustomerData()

        tk.mainloop()
import turtle as tt
import tkinter as ti

#see present position
tp = tt.pos()
print(tp)

#set custom position by x-y axis
tt.setpos(60, 100)

#go to custom position by x-y axis
tt.setx(100)
tt.sety(-100)

#go to the place from where was started
tt.home()
print(tt.pos())

ti.mainloop()