当前位置: 首页>>代码示例>>Python>>正文


Python Tkinter.TOP属性代码示例

本文整理汇总了Python中Tkinter.TOP属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.TOP属性的具体用法?Python Tkinter.TOP怎么用?Python Tkinter.TOP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在Tkinter的用法示例。


在下文中一共展示了Tkinter.TOP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def __init__(self, root, controller):
        f = Figure()
        ax = f.add_subplot(111)
        ax.set_xticks([])
        ax.set_yticks([])
        ax.set_xlim((x_min, x_max))
        ax.set_ylim((y_min, y_max))
        canvas = FigureCanvasTkAgg(f, master=root)
        canvas.show()
        canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        canvas.mpl_connect('key_press_event', self.onkeypress)
        canvas.mpl_connect('key_release_event', self.onkeyrelease)
        canvas.mpl_connect('button_press_event', self.onclick)
        toolbar = NavigationToolbar2TkAgg(canvas, root)
        toolbar.update()
        self.shift_down = False
        self.controllbar = ControllBar(root, controller)
        self.f = f
        self.ax = ax
        self.canvas = canvas
        self.controller = controller
        self.contours = []
        self.c_labels = None
        self.plot_kernels() 
开发者ID:jakevdp,项目名称:sklearn_pydata2015,代码行数:27,代码来源:svm_gui.py

示例2: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def __init__(self, canvas, num, window):
        FigureManagerBase.__init__(self, canvas, num)
        self.window = window
        self.window.withdraw()
        self.set_window_title("Figure %d" % num)
        self.canvas = canvas
        self._num =  num
        _, _, w, h = canvas.figure.bbox.bounds
        w, h = int(w), int(h)
        self.window.minsize(int(w*3/4),int(h*3/4))
        if matplotlib.rcParams['toolbar']=='classic':
            self.toolbar = NavigationToolbar( canvas, self.window )
        elif matplotlib.rcParams['toolbar']=='toolbar2':
            self.toolbar = NavigationToolbar2TkAgg( canvas, self.window )
        else:
            self.toolbar = None
        if self.toolbar is not None:
            self.toolbar.update()
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self._shown = False

        def notify_axes_change(fig):
            'this will be called whenever the current axes is changed'
            if self.toolbar != None: self.toolbar.update()
        self.canvas.figure.add_axobserver(notify_axes_change) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:27,代码来源:backend_tkagg.py

示例3: mainloop

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def mainloop(self):
        try:
            import Tkinter as tk
        except ImportError:
            import tkinter as tk
        from PIL import Image, ImageTk
        from ttk import Frame, Button, Style
        import time
        import socket
        self.root = tk.Toplevel() #Tk()
        self.root.title('Display')
        self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
        self.image1 = ImageTk.PhotoImage(self.image)
        self.panel1 = tk.Label(self.root, image=self.image1)
        self.display = self.image1
        self.frame1 = Frame(self.root, height=50, width=50)
        self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        self.root.after(100, self.advance_image)
        self.root.after(100, self.update_image)
        self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
        #global _started_tkinter_main_loop
        #if not _started_tkinter_main_loop:
        #    _started_tkinter_main_loop = True
        #    print("Starting Tk main thread...") 
开发者ID:jahuth,项目名称:convis,代码行数:26,代码来源:streams.py

示例4: addMessageFrame

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def addMessageFrame(self):
        frame=Frame(self)
        frame.pack(fill=tk.BOTH,side=tk.TOP,\
                expand=1,padx=8,pady=5)

        self.messagelabel=tk.Label(frame,text='Message',bg='#bbb')
        self.messagelabel.pack(side=tk.TOP,fill=tk.X)

        self.text=tk.Text(frame)
        self.text.pack(side=tk.TOP,fill=tk.BOTH,expand=1)
        self.text.height=10

        scrollbar=tk.Scrollbar(self.text)
        scrollbar.pack(side=tk.RIGHT,fill=tk.Y)

        self.text.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.text.yview) 
开发者ID:Xunius,项目名称:Menotexport,代码行数:19,代码来源:menotexport-gui.py

示例5: setup

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def setup(self, channels):
    print "Setting up the channels..."
    self.channels = channels
    # Setup oscilloscope window
    self.root = Tkinter.Tk()
    self.root.wm_title("PiScope")
    if len(self.channels) == 1:
      # Create x and y axis
      xAchse = pylab.arange(0, 4000, 1)
      yAchse = pylab.array([0]*4000)
      # Create the plot
      fig = pylab.figure(1)
      self.ax = fig.add_subplot(111)
      self.ax.set_title("Oscilloscope")
      self.ax.set_xlabel("Time")
      self.ax.set_ylabel("Amplitude")
      self.ax.axis([0, 4000, 0, 3.5])
    elif len(self.channels) == 2:
      # Create x and y axis
      xAchse = pylab.array([0]*4000)
      yAchse = pylab.array([0]*4000)
      # Create the plot
      fig = pylab.figure(1)
      self.ax = fig.add_subplot(111)
      self.ax.set_title("X-Y Plotter")
      self.ax.set_xlabel("Channel " + str(self.channels[0]))
      self.ax.set_ylabel("Channel " + str(self.channels[1]))
      self.ax.axis([0, 3.5, 0, 3.5])
    self.ax.grid(True)
    self.line1 = self.ax.plot(xAchse, yAchse, '-')
    # Integrate plot on oscilloscope window
    self.drawing = FigureCanvasTkAgg(fig, master=self.root)
    self.drawing.show()
    self.drawing.get_tk_widget().pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
    # Setup navigation tools
    tool = NavigationToolbar2TkAgg(self.drawing, self.root)
    tool.update()
    self.drawing._tkcanvas.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
    return 
开发者ID:ankitaggarwal011,项目名称:PiScope,代码行数:41,代码来源:PiScope.py

示例6: configure_subplots

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def configure_subplots(self):
        toolfig = Figure(figsize=(6,3))
        window = Tk.Tk()
        canvas = FigureCanvasTkAgg(toolfig, master=window)
        toolfig.subplots_adjust(top=0.9)
        tool =  SubplotTool(self.canvas.figure, toolfig)
        canvas.show()
        canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:10,代码来源:backend_tkagg.py

示例7: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def __init__(self, *args, **kw):
        global ttyFont, fontHeight, fontWidth
        ttyFont = tkFont.Font(family = 'Courier', size = 10)
        fontWidth = max(map(ttyFont.measure, string.ascii_letters+string.digits))
        fontHeight = int(ttyFont.metrics()['linespace'])
        self.width = kw.get('width', 80)
        self.height = kw.get('height', 25)
        self.callback = kw['callback']
        del kw['callback']
        kw['width'] = w = fontWidth * self.width
        kw['height'] = h = fontHeight * self.height
        Tkinter.Frame.__init__(self, *args, **kw)
        self.canvas = Tkinter.Canvas(bg='#000000', width=w, height=h)
        self.canvas.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
        self.canvas.bind('<Key>', self.keyPressed)
        self.canvas.bind('<1>', lambda x: 'break')
        self.canvas.bind('<Up>', self.upPressed)
        self.canvas.bind('<Down>', self.downPressed)
        self.canvas.bind('<Left>', self.leftPressed)
        self.canvas.bind('<Right>', self.rightPressed)
        self.canvas.focus()

        self.ansiParser = ansi.AnsiParser(ansi.ColorText.WHITE, ansi.ColorText.BLACK)
        self.ansiParser.writeString = self.writeString
        self.ansiParser.parseCursor = self.parseCursor
        self.ansiParser.parseErase = self.parseErase
        #for (a, b) in colorMap.items():
        #    self.canvas.tag_config(a, foreground=b)
        #    self.canvas.tag_config('b'+a, background=b)
        #self.canvas.tag_config('underline', underline=1)

        self.x = 0 
        self.y = 0
        self.cursor = self.canvas.create_rectangle(0,0,fontWidth-1,fontHeight-1,fill='green',outline='green') 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:36,代码来源:tkvt100.py

示例8: edition_change

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def edition_change(self, *event):
        self.shape_type_menu.destroy()
        edition = self.edition_type.get()
        edition_index = self.edition.index(edition)
        self.shape_type_menu = tk.OptionMenu(self.menu_frame, self.shape_type, *self.shape_sets[edition_index], command=self.shape_change)
        helv = tkFont.Font(family='Helvetica',size=self.f_size, weight='bold')
        self.shape_type_menu.config(font=helv)
        self.shape_type_menu.pack(side=tk.TOP, fill=tk.X, expand=True)
        self.shape_type.set(self.shape_sets[edition_index][0]) 
开发者ID:buddyd16,项目名称:Structural-Engineering,代码行数:11,代码来源:aisc_steel_shapes_historic.py

示例9: tabbed_tk_window

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def tabbed_tk_window(self):
        from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
        import sys
        if sys.version_info[0] < 3:
            import Tkinter as tkinter
            import ttk
        else:
            import tkinter
            from tkinter import ttk
        self.root_window = tkinter.Tk()
        self.root_window.title(self.title)
        # quit if the window is deleted
        self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit)
        nb = ttk.Notebook(self.root_window)
        nb.grid(row=1, column=0, sticky='NESW')
        for name, fig in self.figures.items():
            fig.tight_layout()
            tab = ttk.Frame(nb)
            canvas = FigureCanvasTkAgg(self.figures[name], master=tab)
            canvas.draw()
            canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                        expand=True)
            toolbar = NavigationToolbar2Tk(canvas, tab)
            toolbar.update()
            canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                  expand=True)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            nb.add(tab, text=name)
        nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True)
        self.root_window.mainloop()
        self.root_window.destroy() 
开发者ID:MichaelGrupp,项目名称:evo,代码行数:36,代码来源:plot.py

示例10: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def __init__(self, *args, **kw):
        global ttyFont, fontHeight, fontWidth
        ttyFont = tkFont.Font(family = 'Courier', size = 10)
        fontWidth, fontHeight = max(map(ttyFont.measure, string.letters+string.digits)), int(ttyFont.metrics()['linespace'])
        self.width = kw.get('width', 80)
        self.height = kw.get('height', 25)
        self.callback = kw['callback']
        del kw['callback']
        kw['width'] = w = fontWidth * self.width
        kw['height'] = h = fontHeight * self.height
        Tkinter.Frame.__init__(self, *args, **kw)
        self.canvas = Tkinter.Canvas(bg='#000000', width=w, height=h)
        self.canvas.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
        self.canvas.bind('<Key>', self.keyPressed)
        self.canvas.bind('<1>', lambda x: 'break')
        self.canvas.bind('<Up>', self.upPressed)
        self.canvas.bind('<Down>', self.downPressed)
        self.canvas.bind('<Left>', self.leftPressed)
        self.canvas.bind('<Right>', self.rightPressed)
        self.canvas.focus()

        self.ansiParser = ansi.AnsiParser(ansi.ColorText.WHITE, ansi.ColorText.BLACK)
        self.ansiParser.writeString = self.writeString
        self.ansiParser.parseCursor = self.parseCursor
        self.ansiParser.parseErase = self.parseErase
        #for (a, b) in colorMap.items():
        #    self.canvas.tag_config(a, foreground=b)
        #    self.canvas.tag_config('b'+a, background=b)
        #self.canvas.tag_config('underline', underline=1)

        self.x = 0 
        self.y = 0
        self.cursor = self.canvas.create_rectangle(0,0,fontWidth-1,fontHeight-1,fill='green',outline='green') 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:35,代码来源:tkvt100.py

示例11: run

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def run():
    global menu, options, frame
    args = sys.argv[1:]
    if '-l' in args: # cvs is an idiot
        i = args.index('-l')
        args = args[i:i+2]+args
        del args[i+2:i+4]
    for arg in args[:]:
        try:
            i = args.index(arg)
            if arg[:2] == '-o' and args[i+1][0]!='-':
                args[i:i+2] = [] # suck on it scp
        except ValueError:
            pass
    root = Tkinter.Tk()
    root.withdraw()
    top = Tkinter.Toplevel()
    menu = TkConchMenu(top)
    menu.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
    options = GeneralOptions()
    try:
        options.parseOptions(args)
    except usage.UsageError, u:
        print 'ERROR: %s' % u
        options.opt_help()
        sys.exit(1) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:28,代码来源:tkconch.py

示例12: create_main_panel

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def create_main_panel(self):
        # Panels
        top_half = tk.Frame(self.root)
        top_half.pack(side=tk.TOP, expand=True, padx=5, pady=5)
        message = tk.Label(self.root, text="(Note: UI updates are disabled while recording)")
        message.pack(side=tk.TOP, padx=5)
        bottom_half = tk.Frame(self.root)
        bottom_half.pack(side=tk.LEFT, padx=5, pady=10)

        # Images
        self.img_panel = tk.Label(top_half, image=ImageTk.PhotoImage("RGB", size=IMAGE_SIZE)) # Placeholder
        self.img_panel.pack(side = tk.LEFT, expand=False, padx=5)

        # Joystick
        self.init_plot()
        self.PlotCanvas = FigCanvas(figure=self.fig, master=top_half)
        self.PlotCanvas.get_tk_widget().pack(side=tk.RIGHT, expand=False, padx=5)

        # Recording
        textframe = tk.Frame(bottom_half, width=332, height=15, padx=5)
        textframe.pack(side=tk.LEFT)
        textframe.pack_propagate(0)
        self.outputDirStrVar = tk.StringVar()
        self.txt_outputDir = tk.Entry(textframe, textvariable=self.outputDirStrVar, width=100)
        self.txt_outputDir.pack(side=tk.LEFT)
        self.outputDirStrVar.set("samples/" + datetime.now().strftime('%Y-%m-%d_%H:%M:%S'))

        self.record_button = ttk.Button(bottom_half, text="Record", command=self.on_btn_record)
        self.record_button.pack(side = tk.LEFT, padx=5) 
开发者ID:kevinhughes27,项目名称:TensorKart,代码行数:31,代码来源:record.py

示例13: addPathFrame

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def addPathFrame(self):
        frame=Frame(self)
        frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5)

        frame.columnconfigure(1,weight=1)

        #------------------Database file------------------
        label=tk.Label(frame,text='Mendeley Data file:',\
                bg='#bbb')
        label.grid(row=0,column=0,\
                sticky=tk.W,padx=8)

        self.db_entry=tk.Entry(frame)
        self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8)

        self.db_button=tk.Button(frame,text='Open',command=self.openFile)
        self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E)

        hint='''
Default location on Linux:
~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/your_email@www.mendeley.com.sqlite
Default location on Windows:
C:\Users\Your_name\AppData\Local\Mendeley Ltd\Mendeley Desktop\your_email@www.mendeley.com.sqlite'''

        hint_label=tk.Label(frame,text=hint,\
                justify=tk.LEFT,anchor=tk.NW)
        hint_label.grid(row=1,column=0,columnspan=3,\
                sticky=tk.W,padx=8)

        #--------------------Output dir--------------------
        label2=tk.Label(frame,text='Output folder:',\
                bg='#bbb')
        label2.grid(row=2,column=0,\
                sticky=tk.W,padx=8)

        self.out_entry=tk.Entry(frame)
        self.out_entry.grid(row=2,column=1,sticky=tk.W+tk.E,padx=8)
        self.out_button=tk.Button(frame,text='Choose',command=self.openDir)
        self.out_button.grid(row=2,column=2,padx=8,sticky=tk.E) 
开发者ID:Xunius,项目名称:Menotexport,代码行数:41,代码来源:menotexport-gui.py

示例14: run

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def run():
    global menu, options, frame
    args = sys.argv[1:]
    if '-l' in args: # cvs is an idiot
        i = args.index('-l')
        args = args[i:i+2]+args
        del args[i+2:i+4]
    for arg in args[:]:
        try:
            i = args.index(arg)
            if arg[:2] == '-o' and args[i+1][0]!='-':
                args[i:i+2] = [] # suck on it scp
        except ValueError:
            pass
    root = Tkinter.Tk()
    root.withdraw()
    top = Tkinter.Toplevel()
    menu = TkConchMenu(top)
    menu.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)
    options = GeneralOptions()
    try:
        options.parseOptions(args)
    except usage.UsageError as u:
        print('ERROR: %s' % u)
        options.opt_help()
        sys.exit(1)
    for k,v in options.items():
        if v and hasattr(menu, k):
            getattr(menu,k).insert(Tkinter.END, v)
    for (p, (rh, rp)) in options.localForwards:
        menu.forwards.insert(Tkinter.END, 'L:%s:%s:%s' % (p, rh, rp))
    options.localForwards = []
    for (p, (rh, rp)) in options.remoteForwards:
        menu.forwards.insert(Tkinter.END, 'R:%s:%s:%s' % (p, rh, rp))
    options.remoteForwards = []
    frame = tkvt100.VT100Frame(root, callback=None)
    root.geometry('%dx%d'%(tkvt100.fontWidth*frame.width+3, tkvt100.fontHeight*frame.height+3))
    frame.pack(side = Tkinter.TOP)
    tksupport.install(root)
    root.withdraw()
    if (options['host'] and options['user']) or '@' in options['host']:
        menu.doConnect()
    else:
        top.mainloop()
    reactor.run()
    sys.exit(exitStatus) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:48,代码来源:tkconch.py

示例15: __init__

# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import TOP [as 别名]
def __init__(self, args):

        self.db_name = args[1]

        try:
            self.zoom_scale = args[2]
        except:
            self.zoom_scale = 2.8

        self.root = Tk.Tk()
        self.root.wm_title("Viewer")

        self.f = plt.figure(dpi=100, figsize=(12, 8), facecolor='white')
        self.canvas = FigureCanvasTkAgg(self.f, master=self.root)
        self.canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

        self.options_frame = Tk.Frame(self.root)
        self.options_frame.pack()

        toolbar = NavigationToolbar2Tk(self.canvas, self.root)
        toolbar.update()
        self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
        self.ax = plt.subplot2grid((5, 8), (0, 0), rowspan=5,
                                   colspan=4, projection='3d')

        self.num_iters = 0
        self.show_wing = True
        self.show_tube = True
        self.curr_pos = 0
        self.old_n = 0
        self.aerostruct = False

        self.load_db()

        if self.show_wing and not self.show_tube:
            self.ax2 = plt.subplot2grid((4, 8), (0, 4), rowspan=2, colspan=4)
            self.ax3 = plt.subplot2grid((4, 8), (2, 4), rowspan=2, colspan=4)
        if self.show_tube and not self.show_wing:
            self.ax4 = plt.subplot2grid((4, 8), (0, 4), rowspan=2, colspan=4)
            self.ax5 = plt.subplot2grid((4, 8), (2, 4), rowspan=2, colspan=4)
        if self.show_wing and self.show_tube:
            self.ax2 = plt.subplot2grid((5, 8), (1, 4), colspan=4)
            self.ax3 = plt.subplot2grid((5, 8), (0, 4), colspan=4)
            self.ax4 = plt.subplot2grid((5, 8), (3, 4), colspan=4)
            self.ax5 = plt.subplot2grid((5, 8), (4, 4), colspan=4)
            self.ax6 = plt.subplot2grid((5, 8), (2, 4), colspan=4) 
开发者ID:mdolab,项目名称:OpenAeroStruct,代码行数:48,代码来源:plot_wingbox.py


注:本文中的Tkinter.TOP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。