• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ttk.Frame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ttk.Frame的典型用法代码示例。如果您正苦于以下问题:Python Frame类的具体用法?Python Frame怎么用?Python Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: initUI

    def initUI(self):
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=GROOVE, borderwidth=5)
        frame.pack(fill=BOTH, expand=1)
        self.pack(fill = BOTH, expand = 1)

        self.imageLabel = Label(frame, image = "")
        self.imageLabel.pack(fill=BOTH, expand=1)

        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)

        options = [item for item in dir(cv2.cv) if item.startswith("CV_CAP_PROP")]
        option = OptionMenu(self, self.key, *options)
        self.key.set(options[0])
        option.pack(side="left")

        spin = Spinbox(self, from_=0, to=1, increment=0.05)
        self.val = spin.get()
        spin.pack(side="left")
开发者ID:fredericgo,项目名称:PyCV-Processing,代码行数:25,代码来源:frame.py


示例2: init_ui

    def init_ui(self):
        self.connections = {}
        self.button_frame = Frame(self)
        self.button_frame.grid(row=0, column=0, columnspan=2)
        self.map_frame = Frame(self)
        self.map_frame.grid(row=1, column=0, padx=5, pady=5)
        self.picker_frame = Frame(self)
        self.picker_frame.grid(row=1, column=1)

        self.button_new = Button(self.button_frame)
        self.button_new["text"] = "New"
        self.button_new["command"] = self.new_map
        self.button_new.grid(row=0, column=0, padx=2)

        self.open = Button(self.button_frame)
        self.open["text"] = "Open"
        self.open["command"] = self.open_map
        self.open.grid(row=0, column=1, padx=2)

        self.save = Button(self.button_frame)
        self.save["text"] = "Save"
        self.save["command"] = self.save_map
        self.save.grid(row=0, column=2, padx=2)

        self.get_map_list()
        self.map_list.grid(row=0, column=3, padx=2)
开发者ID:TheScarletSword,项目名称:pokereddeluxe,代码行数:26,代码来源:map_editor.py


示例3: initUI

	def initUI(self):
		
		self.pack(fill=BOTH, expand=1)
		
		#create special frame for buttons at the top
		frame = Frame(self)
		frame.pack(fill=X)
		
		search = Entry(frame)
		
		def callback():
			#create new window
			main(Search.SearchFrontPage(search.get()))
		
		b = Button(frame, text="Search", width=5, command=callback)
		b.pack(side=RIGHT)
		search.pack(side=RIGHT)
		
		def login():
			#change login credentials
			self.credentials = reddituserpass.main()
			self.parent.destroy()
		
		login = Button(frame, text="Login", width=5, command=login)
		login.pack(side=LEFT)
		
		self.drawWindow()
开发者ID:codedone,项目名称:FinalProject,代码行数:27,代码来源:gui.py


示例4: __init__

 def __init__(self, parent):
     Frame.__init__(self, parent)
     self.parent = parent
     self.u = utils('atoutput.pkl')
     self.km = dict()
     self.price = dict()
     self.km[0] = (min(self.u.all_km), max(self.u.all_km))
     self.price[0] = (min(self.u.all_price), max(self.u.all_price))
     self.zoom_level = 0
     try:
         self.parent.title("Auto trader results")
         self.is_standalone = True
     except:
         self.is_standalone = False
     self.style = Style()
     self.style.theme_use("classic")
     # Assume the parent is the root widget; make the frame take up the
     # entire widget size.
     print self.is_standalone
     if self.is_standalone:
         self.w, self.h = map(int,
             self.parent.geometry().split('+')[0].split('x'))
         self.w, self.h = 800, 800
     else:
         self.w, self.h = 600, 600
     self.c = None
     # Are they hovering over a data point?
     self.is_hovering = False
     # Filter the description strings: lower and whiten any non-matching
     # data point.
     self.filter = ''
     self.re = list()
     self.replot()
开发者ID:pigboysid,项目名称:myat,代码行数:33,代码来源:canvas.py


示例5: insert_frame

    def insert_frame(self, name, parent_frame_name, idx, frame_type=None, **kwargs):
        parent_frame = self.frames[parent_frame_name]
        frame = Frame(parent_frame)

        # add frame to list of frames
        self.frames[name] = frame

        # pre-fill the frame
        if frame_type is None:
            pass
        elif frame_type == 'plot':
            # generate canvas
            dim = kwargs['shape']
            f = Figure(figsize=dim, dpi=113  )
            a = f.add_subplot(111)
            canvas = FigureCanvasTkAgg(f, master=frame)
            
            # Commit the canvas to the gui
            canvas.get_tk_widget().pack()

            # save canvas data for later access
            self.mpl_data[name] = {}
            self.frame_data['plot'] = {'mpl_canvas':canvas}

        # commit the frame to workspace
        frame.grid(row=idx[0], column=idx[1])
开发者ID:ncsurobotics,项目名称:acoustics,代码行数:26,代码来源:gui_lib.py


示例6: __init__

    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.selected = "";
        self.controller = controller
        label = Label(self, text="Select server", font=TITLE_FONT, justify=CENTER, anchor=CENTER)
        label.pack(side="top", fill="x", pady=10)
        
        self.button1 = Button(self, text="Next",state="disabled", command=self.callback_choose)
        button2 = Button(self, text="Refresh", command=self.callback_refresh)        
        button3 = Button(self, text="Back", command=self.callback_start)
        
        scrollbar = Scrollbar(self)
        self.mylist = Listbox(self, width=100, yscrollcommand = scrollbar.set )
        self.mylist.bind("<Double-Button-1>", self.twoClick)

        self.button1.pack()
        button2.pack()
        button3.pack()
        # create list with a scroolbar
        scrollbar.pack( side = "right", fill="y" )
        self.mylist.pack( side = "top", fill = "x", ipadx=20, ipady=20, padx=20, pady=20 )
        scrollbar.config( command = self.mylist.yview )
        # create a progress bar
        label2 = Label(self, text="Refresh progress bar", justify='center', anchor='center')
        label2.pack(side="top", fill="x")
        
        self.bar_lenght = 200
        self.pb = Progressbar(self, length=self.bar_lenght, mode='determinate')
        self.pb.pack(side="top", anchor='center', ipadx=20, ipady=20, padx=10, pady=10)
        self.pb.config(value=0)
开发者ID:kristapsdreija,项目名称:Frogs-vs-Flies,代码行数:30,代码来源:tkinter_main.py


示例7: init_ui

    def init_ui(self):
        self.connections = {}
        self.button_frame = Frame(self)
        self.button_frame.grid(row=0, column=0, columnspan=2)
        self.map_frame = Frame(self)
        self.map_frame.grid(row=1, column=0, padx=5, pady=5, sticky=N + S + E + W)
        self.picker_frame = Frame(self)
        self.picker_frame.grid(row=1, column=1)

        self.button_new = Button(self.button_frame)
        self.button_new["text"] = "New"
        self.button_new["command"] = self.new_map
        self.button_new.grid(row=0, column=0, padx=2)

        self.menubar = Menu(self)

        menu = Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New")
        menu.add_command(label="Open")
        menu.add_command(label="Save")

        self.open = Button(self.button_frame)
        self.open["text"] = "Open"
        self.open["command"] = self.open_map
        self.open.grid(row=0, column=1, padx=2)

        self.save = Button(self.button_frame)
        self.save["text"] = "Save"
        self.save["command"] = self.save_map
        self.save.grid(row=0, column=2, padx=2)

        self.get_map_list()
        self.map_list.grid(row=0, column=3, padx=2)
开发者ID:PikalaxALT,项目名称:pokemon-reverse-engineering-tools,代码行数:34,代码来源:map_editor.py


示例8: __init__

    def __init__(self, master, item_width, item_height, item_relief=None, item_borderwidth=None, item_padding=None, item_style=None, offset_x=0, offset_y=0, gap=0, **kwargs):
        kwargs["width"] = item_width+offset_x*2
        kwargs["height"] = offset_y*2

        Frame.__init__(self, master, **kwargs)

        self._item_borderwidth = item_borderwidth
        self._item_relief = item_relief
        self._item_padding = item_padding
        self._item_style= item_style
        self._item_width = item_width
        self._item_height = item_height
        
        self._offset_x = offset_x
        self._offset_y = offset_y
               
        self._left = offset_x
        self._top = offset_y
        self._right = self._offset_x + self._item_width
        self._bottom = self._offset_y

        self._gap = gap

        self._index_of_selected_item = None
        self._index_of_empty_container = None

        self._list_of_items = []
        self._position = {}

        self._new_y_coord_of_selected_item = None
开发者ID:jacob-carrier,项目名称:code,代码行数:30,代码来源:recipe-580717.py


示例9: initplayer

    def initplayer(self):
        self.parentframe = Frame(self)
        self.parentframe.pack(fill=BOTH, expand=True)
        self.videoFrame = Frame(self.parentframe, width=800, height=480)
        self.videoFrame.pack(side="top", fill="both", expand=True)
        self.buttonframe = Frame(self.parentframe, padding="2 2 1 1")
        self.buttonframe.pack(side="bottom", fill="x", expand=False)

        self.seekbar = Scale(self.buttonframe, from_= 0, to=100, orient=HORIZONTAL)
        self.seekbar.grid(column=0, columnspan=4, row=0, sticky=[N, E, S, W])
        self.seekbar.configure(command=self.seeked)

        self.selectbutton = Button(self.buttonframe, text="Select File")
        self.selectbutton.grid(column=0, row=1, sticky=[E,W])
        self.streambutton = Button(self.buttonframe, text="Open HTTP", command=self.streamopen)
        self.streambutton.grid(column=1, row=1, sticky=[E,W])
        self.playbutton = Button(self.buttonframe, text="Play")
        self.playbutton.config(command=self.playpause)
        self.playbutton.grid(column=2, row=1, sticky=[E,W])
        self.fullscreenbutton = Button(self.buttonframe, text="Fullscreen", command=self.togglefullscreen)
        self.fullscreenbutton.grid(column=3, row=1, sticky=[E,W])
        for child in self.buttonframe.winfo_children(): child.grid_configure(padx=5, pady=5)
        self.buttonframe.rowconfigure(0, weight=1)
        self.buttonframe.rowconfigure(1, weight=1)
        self.buttonframe.columnconfigure(0, weight=1)
        self.buttonframe.columnconfigure(1, weight=1)
        self.buttonframe.columnconfigure(2, weight=1)
        self.buttonframe.columnconfigure(3, weight=1)

        self.selectbutton.configure(command=self.fileopen)
        self.videoFrame.bind("<Button-1>",self.playpause)
        self.parent.bind("<F11>", self.togglefullscreen)
        self.parent.bind("<Motion>",self.mouseops)
开发者ID:ankit255,项目名称:mplay,代码行数:33,代码来源:mplay.py


示例10: __init__

 def __init__(self,parent,api,id):
     Frame.__init__(self, parent)
     self.parent = parent
     self.api = api
     self.id = id
     self.anySearch = False
     self.initUI()
开发者ID:ncyrcus,项目名称:tareas-lp,代码行数:7,代码来源:gui.py


示例11: initUI

    def initUI(self):
        
        #some aesthetic definitions 
        self.parent.title("Message Responder")
        self.style = Style()
        self.style.theme_use("classic")


        #building frame
        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=True)


        self.pack(fill=BOTH, expand=True)
        
        #adding some widgets
        label = Label(frame, text = self.text, wraplength = 495, justify = LEFT)
        label.pack()
        self.textBox = Text(frame, height = 2, width = 495)
        self.textBox.pack(side = BOTTOM)
        #self.textBox.insert(END, '#enter ye comments here')
        labelBox = Label(frame, text = "Actual Results:")
        labelBox.pack(anchor = W, side = BOTTOM)
        passButton = Button(self, text="PASS", command=self.btnClickedPass)
        passButton.pack(side=RIGHT, padx=5, pady=5)
        failButton = Button(self, text="FAIL", command=self.btnClickedFail)
        failButton.pack(side=RIGHT)
开发者ID:jnmcclai,项目名称:msg_responder,代码行数:27,代码来源:msg_responder.py


示例12: __init__

class binaryErosionApp:
	def __init__(self, parent):
		self.parent = parent
		self.frame = Frame(self.parent)
		self.parent.title("Binary Erosion")
		self.initUI()
	
	def initUI(self):
		#Create 3x3 Grid
		for columns in range(0, 3):
			self.parent.columnconfigure(columns, pad = 14)
		for rows in range(0, 3):
			self.parent.rowconfigure(rows, pad = 14)
		
		#Add Noise Options
		binaryErosion1 = Button(self.frame, width = 10, height = 3, padx = 10, pady = 10, wraplength = 60, text = "Binary Erosion 1", command = self.binaryErosion1Clicked)
		binaryErosion2 = Button(self.frame, width = 10, height = 3, padx = 10, pady = 10, wraplength = 60, text = "Binary Erosion 2", command = self.binaryErosion2Clicked)
		
		binaryErosion1.grid(row = 1, column = 1, padx = 10, pady = 10, sticky = 'w')
		binaryErosion2.grid(row = 1, column = 2, padx = 10, pady = 10, sticky = 'w')
		
		self.frame.pack()

	def binaryErosion1Clicked(self):
		global _img, red, green, blue
			
		structure = zeros((20, 20))
		structure[range(20), range(20)] = 1.0
		
		red = where(red[:,:] > 255.0 * 0.6, 1.0, 0.0)
		green = where(green[:,:] > 255.0 * 0.6, 1.0, 0.0)
		blue = where(blue[:,:] > 255.0 * 0.6, 1.0, 0.0)
			
		for a in range(0, _img.shape[0]):
			for b in range(0, _img.shape[1]):
				_img[a, b, 0] = (red[a, b] * 255.0).astype('uint8')
				_img[a, b, 1] = (green[a, b] * 255.0).astype('uint8')
				_img[a, b, 2] = (blue[a, b] * 255.0).astype('uint8')
		updateImage()
		
	def binaryErosion2Clicked(self):
		global _img, red, green, blue
		
		structure = zeros((20, 20))
		structure[range(20), range(20)] = 1.0
		
		red = where(red[:,:] > 255.0 * 0.6, 1.0, 0.0)
		green = where(green[:,:] > 255.0 * 0.6, 1.0, 0.0)
		blue = where(blue[:,:] > 255.0 * 0.6, 1.0, 0.0)
		
		red   = ndimage.binary_erosion(red, structure)
		green = ndimage.binary_erosion(green, structure)
		blue  = ndimage.binary_erosion(blue, structure)
		
		for a in range(0, _img.shape[0]):
			for b in range(0, _img.shape[1]):
				_img[a, b, 0] = (red[a, b] * 255.0).astype('uint8')
				_img[a, b, 1] = (green[a, b] * 255.0).astype('uint8')
				_img[a, b, 2] = (blue[a, b] * 255.0).astype('uint8')
		updateImage()
开发者ID:Kaikat,项目名称:ImageAndSoundEffects,代码行数:60,代码来源:imageAndSoundEffects.py


示例13: initUI

    def initUI(self):
        self.parent.title("Test")
        self.frameTab = Frame(self, relief=RAISED, borderwidth=1)
        self.frameTab.grid(row=3, column=0, columnspan=4)
        self.grid(row=0, column=0)
        self.frameTab.grid(row=0, column=0)
        self.note_book = Notebook(self.frameTab)
        self.specific_actions = ActionModulation.ActionModulation(self.note_book)
        self.note_book.add(self.specific_actions.getFrame(), text="specific actions")
        self.general_actions = GeneralActionModulation.GeneralActionModulation(self.note_book)
        self.note_book.add(self.general_actions.getFrame(), text="general actions")
        self.note_book.grid(row=0, column=0)

        self.frameButtons = Frame(self, relief=RAISED, borderwidth=1)
        self.frameButtons.grid(row=3, column=0, columnspan=4)
        self.buttonReset = Button(self.frameButtons, text="Reset")
        self.buttonReset.grid(row=0, column=0)
        self.buttonAbort = Button(self.frameButtons, text="Abort")
        self.buttonAbort.grid(row=0, column=1)
        self.buttonStop = Button(self.frameButtons, text="Stop")
        self.buttonStop.grid(row=0, column=2)
        self.buttonSendAction = Button(self.frameButtons, text="Send Action")
        self.buttonSendAction.grid(row=0, column=4)
        self.buttonSendEmotion = Button(self.frameButtons, text="Send Emotion")
        self.buttonSendEmotion.grid(row=0, column=5)
开发者ID:julianangel,项目名称:EmotionBot,代码行数:25,代码来源:NewActionModulation.py


示例14: initUI

	def initUI(self):
		crawlVar = IntVar()
		scanVar = IntVar()
		dnsVar = IntVar()
		emailVar = IntVar()
		self.filename = StringVar()
		self.parent.title("E-Z Security Audting")
		self.style = Style()
		self.style.theme_use("default")
		
		frame = Frame(self, borderwidth=1)
		frame.pack(side=TOP, fill=BOTH)
		
		self.pack(side=TOP, fill=BOTH)
		
		dnsButton = Checkbutton(self, text="DNS Recon", variable=dnsVar)
		dnsButton.pack(fill=X)
		scanButton = Checkbutton(self, text="Port Scan", variable=scanVar)
		scanButton.pack(fill=X)
		crawlButton = Checkbutton(self, text="Web Crawl", variable=crawlVar)
		crawlButton.pack(fill=X)
		emailButton = Checkbutton(self, text="Email Gathering", variable=emailVar)
		emailButton.pack(fill=X)

		lab = Label(self, width=15, text="Filename", anchor='w')
		ent = Entry(self,textvariable=self.filename)
		self.pack(side=TOP, fill=X, padx=5, pady=5)
		lab.pack(side=LEFT)
		ent.pack(side=RIGHT, fill=X)
开发者ID:kerocode,项目名称:python_tool,代码行数:29,代码来源:securityTool.py


示例15: __init__

    def __init__(self, master, track, sequencer):
        TrackFrame.__init__(self, master, track)

        self.id_label = Label(self, text=str(track.id))
        self.id_label.pack(side='left')

        self.instrument_label = Label(self, text=str(track.instrument_tone), width=3)
        self.instrument_label.pack(side='left')

        mute_var = IntVar()

        self.mute_toggle = Checkbutton(self, command=lambda: check_cmd(track, mute_var), variable=mute_var)
        self.mute_toggle.pack(side='left')

        mute_var.set(not track.mute)

        rhythm_frame = Frame(self)
        rhythm_frame.pack(side='right')

        subdivision = sequencer.measure_resolution / sequencer.beats_per_measure

        self.buttons = []

        for b in range(0, len(self.track.rhythms)):
            button = RhythmButton(rhythm_frame, track, b, not b % subdivision)
            self.buttons.append(button)
            button.grid(row=0, column=b, padx=1)

        self.beat = 0
开发者ID:ladsmund,项目名称:msp_group_project,代码行数:29,代码来源:track_frame.py


示例16: __init__

    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent

        self.py = pydle()

        self._initUI()
开发者ID:claudemuller,项目名称:pydle,代码行数:7,代码来源:app.py


示例17: __init__

class RadioButtonList:  # Widget class
    def __init__(self, frm, name, ch1, ch2, st, i):
        self.frame = Frame(frm.frame)
        self.frame.grid()
        self.ch1 = ch1
        self.ch2 = ch2
        self.i = i
        self.st = st
        v = IntVar()
        self.v = v
        self.shuu = name
        self.length = len(name)
        self.rb = {}
        r = 0
        self.r = r
        for txt, val in name:
            self.rb[r] = Radiobutton(frm.frame, text=txt, padx=20, variable=v, value=val, command=self.onclick)
            self.rb[r].grid(row=i + r, column=0, sticky=W, pady=2)
            r = r + 1
        self.r = r

    def onclick(self):
        if self.ch1 == 1:
            if self.v.get() == self.ch2:
                self.st.set_text("true")
                # v.add(self.st,self.i+self.r+1)
            else:
                self.st.set_text("false")
                # v.add(self.st,self.i+self.r+1)
        else:
            self.st.set_text("Your choice:" + self.shuu[self.v.get() - 1][0])
开发者ID:nnj1008,项目名称:silver-lining,代码行数:31,代码来源:P2010CS1007_Tkinter.py


示例18: initUI

    def initUI(self):
        self.parent.title("TKontact")
        self.style = Style()
        self.style.theme_use("default")

#        frame = Frame(self, relief=RAISED, borderwidth=1)
#        frame.pack(fill=BOTH, expand=1)

#        self.pack(fill=BOTH, expand=1)

        self.frame_left = Frame(self)
        self.frame_left.grid(row=0, column=0)
        self.frame_right = Frame(self)
        self.frame_right.grid(row=0, column=1)

        self.add_field("lastname")
        self.add_field("firstname")
        self.add_field("phone")
        self.add_button("add")
        self.add_button("open")
        self.add_button("delete")
        self.add_field("search")
        self.add_button("search")
        self.add_button("quit")

        self.add_contactlist()
        self.pack()
开发者ID:toutpt,项目名称:formation.python,代码行数:27,代码来源:view.py


示例19: initUI

    def initUI(self):
        #<standard set up>
        self.parent.title("Buttons")
        self.style = Style()
        self.style.theme_use("default")
        #</standard set up>

        #if you put buttons here, it will initiate the buttons.
        #then it will initiate the frame. You would get two columns.
        #buttons appear in the second "lowered" area and not the raised frame.

        
        
        #<adding an additional frame>
        frame = Frame(self, relief=RAISED, borderwidth=1)
        
        frame.pack(fill=BOTH, expand =1)
        #</adding an additional frame>

        #<standard self.pack>
        self.pack(fill=BOTH, expand =1)
        #</standard self.pack>

        #<buttons are placed here>
        closeButton = Button (self, text = "Close")
        closeButton.pack(side=RIGHT, padx=5, pady =5)
        okButton = Button(self, text = "OK")
        okButton.pack(side=RIGHT)
开发者ID:91xie,项目名称:FYP,代码行数:28,代码来源:ButtonExample.py


示例20: __init__

 def __init__(self, parent):
     Frame.__init__(self, parent)   
     self.parent = parent
     self.player1 = Player()
     self.player2 = ComputerPlayer()
     self.isOver = True
     self.initUI()
开发者ID:arnibarnason,项目名称:Battleship,代码行数:7,代码来源:Battleship.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ttk.Label类代码示例发布时间:2022-05-27
下一篇:
Python ttk.Entry类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap