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


Python Label.place方法代码示例

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


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

示例1: Example

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Scale")
        self.style = Style()
        self.style.theme_use("default")        
        
        self.pack(fill=BOTH, expand=1)

        scale = Scale(self, from_=0, to=100, 
            command=self.onScale)
        scale.place(x=20, y=20)

        self.var = IntVar()
        self.label = Label(self, text=0, textvariable=self.var)        
        self.label.place(x=130, y=70)

    def onScale(self, val):
     
        v = int(float(val))
        self.var.set(v)
开发者ID:minghuadev,项目名称:minecraft-tests,代码行数:30,代码来源:tc-scale.py

示例2: initUI

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
    def initUI(self):

        # Style().configure("TButton", padding=(10, 10, 10, 10), 
        #     font='serif 8', weight=1)
        mri = Image.open("mri.jpg")
        # mri.resize((w, h), Image.ANTIALIAS)
        background_image=ImageTk.PhotoImage(mri)
        background_label = Label(self, image=background_image)
        background_label.photo=background_image
        background_label.place(x=0, y=0, relheight=1)        
        self.columnconfigure(0, pad=10, weight=1)
        self.columnconfigure(1, pad=10, weight=1)
        self.columnconfigure(2, pad=20, weight=1)
        self.rowconfigure(0, pad=20, weight=1)
        self.rowconfigure(1, pad=20, weight=1)
        self.rowconfigure(2, pad=20, weight=1)
        self.customFont = tkFont.Font(family="Helvetica", size=15)
        # Style().configure('green/black.TButton', foreground='yellow', background=tk_rgb, activefill="red",font=self.customFont)
        entry = Entry(self) #TODO: REMOVE?
        f = open('games.txt')
        buttonArray = []
        for i, line in enumerate(f):
        	line = line.split(':')
        	filename = line[0].translate(None, ' \n').lower()
        	imagefile = Image.open(filename + "-thumbnail.png")
        	image = ImageTk.PhotoImage(imagefile)
        	label1 = Label(self, image=image)
        	label1.image = image                         # + "\n" + line[1]
        	tk_rgb = "#%02x%02x%02x" % (100+35*(i%5), 50+100*(i%3), 70+80*(i%2))
        	button = (Button(self, text=line[0], image=image, compound="bottom", bd=0, bg=tk_rgb, font=self.customFont, command = lambda filename=filename :os.system("python " + filename + ".py")))
        	button.grid(row=i/3, column=i%3)
        f.close()
        
        self.pack(fill=BOTH, expand=1)
开发者ID:thomasmacpherson,项目名称:entertainmentfrontend,代码行数:36,代码来源:frontend.py

示例3: Example

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Example(Frame):

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

        self.parent = parent
        self.initUI()

    def initUI(self):

        self.parent.title("Listbox + Scale + ChkBtn")
        self.pack(fill=BOTH, expand=1)
        acts = ['Scarlett Johansson', 'Rachel Weiss',
            'Natalie Portman', 'Jessica Alba']

        lb = Listbox(self)
        for i in acts:
            lb.insert(END, i)

        lb.bind("<<ListboxSelect>>", self.onSelect)
        lb.place(x=20, y=20)

        self.var = StringVar()
        self.label = Label(self, text=0, textvariable=self.var)
        self.label.place(x=20, y=190)

        scale = Scale(self, from_=0, to=100, command=self.onScale)
        scale.place(x=20, y=220)

        self.var_scale = IntVar()
        self.label_scale = Label(self, text=0, textvariable=self.var_scale)
        self.label_scale.place(x=180, y=220)

        self.var_chk = IntVar()
        cb = Checkbutton(self, text="Test", variable=self.var_chk,
                command=self.onClick)
        cb.select()
        cb.place(x=220, y=60)

    def onSelect(self, val):
        sender = val.widget
        idx = sender.curselection()
        value = sender.get(idx)
        self.var.set(value)

    def onScale(self, val):
        v = int(float(val))
        self.var_scale.set(v)

    def onClick(self):
        if self.var_chk.get() == 1:
            self.var.set("checked")
        else:
            self.var.set("unchecked")
开发者ID:,项目名称:,代码行数:56,代码来源:

示例4: Example

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Listbox") 
        
        self.pack(fill=BOTH, expand=1)

        acts = ['Scarlett Johansson', 'Rachel Weiss', 
            'Natalie Portman', 'Jessica Alba']
        #This is a list of actresses to be shown in the listbox.

        lb = Listbox(self)
        for i in acts:
            lb.insert(END, i)
        #We create an instance of the Listbox and insert all the items from the above mentioned list.
            
        lb.bind("<<ListboxSelect>>", self.onSelect)
        #When we select an item in the listbox, the <<ListboxSelect>> event is generated. 
        #We bind the onSelect() method to this event.
        
        lb.place(x=20, y=20)

        self.var = StringVar()
        self.label = Label(self, text=0, textvariable=self.var)
        #A label and its value holder is created. 
        #In this label we will display the currently selected item.
        self.label.place(x=20, y=210)

    def onSelect(self, val):
      
        sender = val.widget
        #We get the sender of the event. 
        #It is our listbox widget.
        idx = sender.curselection()
        #We find out the index of the selected item using the curselection() method.
        value = sender.get(idx)
        #The actual value is retrieved with the get() method, which takes the index of the item.
        self.var.set(value)
开发者ID:griadooss,项目名称:HowTos,代码行数:47,代码来源:11_widgets_listbox.py

示例5: FirstWindow

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class FirstWindow(Frame):
    def __init__(self, parent, controller, listener):
        Frame.__init__(self, parent)

        self.parent = parent
        self.controller = controller
        self.listener = listener
        self.controller.add_listener(self.listener)
        self.initUI()

    def initUI(self):
        self.centerWindow()

        self.parent.title("Cursor")
        self.style = Style()
        self.style.theme_use("clam")
        self.style.configure("TFrame")

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

        self.label = Label(self)
        self.label.configure(text="Hold your hand above the device for two seconds...")
        self.label.place(x=50, y=50)

        quitButton = Button(self, text="Quit",
                            command=self.quit)
        quitButton.place(x=50, y=100)

    def update_label(self):
        self.label.configure(text="You can now use the cursor.")

    def remove(self):
        self.controller.remove_listener(self.listener)

    def centerWindow(self):
        w, h = 450, 180

        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()

        x = (sw - w)/2
        y = (sh - h)/2
        self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))
开发者ID:OanaRatiu,项目名称:Licenta,代码行数:45,代码来源:main.py

示例6: initUI

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
    def initUI(self):
        self.parent.title("Buttons")
        self.style=Style()
        self.style.theme_use("default")

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

        bard = Image.open("images.jpg")
        bardejov = ImageTk.PhotoImage(bard)
        label1 = Label(frame, image=bardejov)
        label1.image = bardejov
        label1.place(x=20, y=20)

        
        self.pack(fill=BOTH, expand=1)
        closebutton = Button(self, text="Close")
        closebutton.pack(side=RIGHT, padx=5, pady=5)
        okbutton = Button(self, text="OK")
        okbutton.pack(side=RIGHT)
开发者ID:shikhagarg0192,项目名称:Python,代码行数:22,代码来源:gui7.py

示例7: Example

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Listbox") 
        
        self.pack(fill=BOTH, expand=1)

        # put our data in from our global data object
        lb = Listbox(self)
        for i in data:
            lb.insert(END, i)
            
        # add event listener with call back to show
        # when the list object is selected, show visual feedback
        lb.bind("<<ListboxSelect>>", self.onSelect)    
            
        # absolute positioning
        lb.place(x=20, y=20)

        self.var = StringVar()
        self.label = Label(self, text=0, textvariable=self.var)        
        self.label.place(x=20, y=210)

    def onSelect(self, val):
      
        sender = val.widget
        idx = sender.curselection()
        value = sender.get(idx)   

        self.var.set(value)
开发者ID:ccjoness,项目名称:code-guild,代码行数:39,代码来源:listbox_layout.py

示例8: Example

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Listbox") 
        
        self.pack(fill=BOTH, expand=1)

        acts = ['Scarlett Johansson', 'Rachel Weiss', 
            'Natalie Portman', 'Jessica Alba']

        lb = Listbox(self)
        for i in acts:
            lb.insert(END, i)
            
        lb.bind("<<ListboxSelect>>", self.onSelect)    
            
        lb.place(x=20, y=20)

        self.var = StringVar()
        self.label = Label(self, text=0, textvariable=self.var)        
        self.label.place(x=20, y=210)

    def onSelect(self, val):
      
        sender = val.widget
        idx = sender.curselection()
        value = sender.get(idx)   

        self.var.set(value)
开发者ID:minghuadev,项目名称:minecraft-tests,代码行数:38,代码来源:td-listbox.py

示例9: __init__

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]

#.........这里部分代码省略.........
		self.root.rowconfigure(10, pad=3)
		self.root.rowconfigure(11, pad=3)
		self.root.rowconfigure(12, pad=3)
		self.root.rowconfigure(13, pad=3)
		self.root.rowconfigure(14, pad=3)
		self.root.rowconfigure(15, pad=3)
		self.root.rowconfigure(16, pad=3)
		self.root.rowconfigure(17, pad=3)
		self.root.rowconfigure(18, pad=3)
		self.root.rowconfigure(19, pad=3)
		self.root.rowconfigure(20, pad=3)
		self.root.rowconfigure(21, pad=3)
		self.root.rowconfigure(22, pad=3)

		self.root.rowconfigure(0, weight=1)
        	self.root.columnconfigure(0, weight=1)
		global e
		e = Entry(self, width=4)
		e.grid(row=16, column=4)
		e.focus_set()
		
		#self.button = Button(self, text="Upload", fg="red", command=self.logout)
		#self.button.pack(side = RIGHT)
		
		
  		button_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5}
		a = Tkinter.Button(self, text='Browse', command=self.askopenfilename)#.pack(**button_opt)
		a.grid(row =1 , column =4)		
		b = Tkinter.Button(self, text='Upload', command=self.upload)#.pack(**button_opt)
		b.grid(row = 3, column =4)		
		
		f=client.doCmd({"cmd":"view"})
		for i in f:
			FileInfo[i.split(":")[0]].append(i.split(":")[1].split("/")[-1])		
		
		print FileInfo
       		t = SimpleTable(self, len(f)/5,5)
		t.grid(row = 4, column =4)
		
		#MyButton1 = Button(self, text="Download 5", width=14, command=self.Download)
		#MyButton1.grid(row=15, column=4)

		#MyButton2 = Button(self, text="Download 6", width=14, command=self.Download)
		#MyButton2.grid(row=15, column=5)

		#MyButton3 = Button(self, text="Download 7", width=14, command=self.Download)
		#MyButton3.grid(row=15, column=6)	
	
		#MyButton4 = Button(self, text="Download 4", width=14, command=self.Download)
		#MyButton4.grid(row=15, column=3)

		#MyButton5 = Button(self, text="Download 3", width=14, command=self.Download)
		#MyButton5.grid(row=15, column=2)

		#MyButton6 = Button(self, text="Download 2", width=14, command=self.Download)
		#MyButton6.grid(row=15, column=1)

		#MyButton7 = Button(self, text="Download 1", width=14, command=self.Download)
		#MyButton7.grid(row=15, column=0)

		#MyButton8 = Button(self, text="Download 8", width=14, command=self.Download)
		#MyButton8.grid(row=15, column=7)

		MyButton9 = Button(self, text="Download", width=14, command=self.callback)
		MyButton9.grid(row=17, column=4)

		creation = tk.Label( self, text = "Created by Kuber, Digvijay, Anahita & Payal", borderwidth =5, width =45)
		creation.grid(row=50 , column = 4)
		

	
		self.file_opt = options = {}		
  		options['defaultextension'] = '.txt'
  		options['filetypes'] = [('all files', '.*'), ('text files', '.txt')]
  	        options['initialdir'] = 'C:\\'
  		options['initialfile'] = 'myfile.txt'
  	        options['parent'] = root
  	        options['title'] = 'Browse'

		self.dir_opt = options = {}
  		options['initialdir'] = 'C:\\'
  		options['mustexist'] = False
  		options['parent'] = root
  		options['title'] = 'Browse'

		image = Image.open("./header.png")
		photo = ImageTk.PhotoImage(image)
		label = Label(image=photo)
		label.image = photo # keep a reference!
		label.place(width=768, height=576)
		label.grid(row = 0 , column = 0 )
		label.pack(side = TOP)

		self.centerWindow()
		self.master.columnconfigure(10, weight=1)
		#Tkinter.Button(self, text='upload file', command=self.Fname).pack(**button_opt)	
		t = self.file_name = Text(self, width=39, height=1, wrap=WORD)
		t.grid(row = 2, column =4)
		extra1 = tk.Label(self, text = "please give a file number", borderwidth = 5, width =45)
		extra1.grid(row =15, column =4)
开发者ID:kuberkaul,项目名称:Go-Data,代码行数:104,代码来源:gui(tkinter).py

示例10: Window

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Window(Frame):
	def __init__(self, parent):
		Frame.__init__(self, parent)
		self.parent = parent
		self.initUI()

	def initUI(self):
		self.style = Style()
		self.style.theme_use("clam")
		self.pack(fill=BOTH,expand=5)
		self.parent.title("Document Similarity Checker")
		self.dir = "Choose a directory"
		self.setupInputs()
		self.setButton()
	
	def setupInputs(self):
		self.chooseDir = Button(self, text="Choose",command=self.getDir)
		self.chooseDir.place(x=10, y=10)
		self.selpath = Label(self, text=self.dir, font=("Helvetica", 12))
		self.selpath.place(x=150, y=10)

		self.aLabel = Label(self, text="Alpha", font=("Helvetica", 12))
		self.aLabel.place(x=10, y=50)
		self.aEntry = Entry()
		self.aEntry.place(x=200,y=50,width=400,height=30)

		self.bLabel = Label(self, text="Beta", font=("Helvetica", 12))
		self.bLabel.place(x=10, y=100)
		self.bEntry = Entry()
		self.bEntry.place(x=200,y=100,width=400,height=30)

	def setButton(self):
		self.quitButton = Button(self, text="Close",command=self.quit)
		self.quitButton.place(x=520, y=250)

		self.browserButton = Button(self, text="Open Browser",command=self.browser)
		self.browserButton.place(x=400, y=250)
		self.browserButton.config(state=DISABLED)

		self.generate = Button(self, text="Generate Data",command=self.genData)
		self.generate.place(x=10, y=250)

	def browser(self):
		import webbrowser
		webbrowser.get('firefox').open('data/index.html')
		self.browserButton.config(state=DISABLED)

	def getDir(self):
		globals.dir = tkFileDialog.askdirectory(parent=self.parent,initialdir="/",title='Select a directory')
		self.selpath['text'] = globals.dir
		#print globals.dir

	#validate and process data
	def genData(self):
		valid = True
		try:
			globals.alpha = float(self.aEntry.get())
		except ValueError:
			globals.alpha = 0.0
			valid = False
		try:
			globals.beta = float(self.bEntry.get())
		except ValueError:
			globals.beta = 0.0
			valid = False

		if not os.path.isdir(globals.dir) or globals.alpha>=1.0 or globals.beta>=1.0:
			valid = False

		if valid:
			self.generate.config(state=DISABLED)
			from compute import main as computeMain
			computeMain()
			from jsonutil import main as jsonMain
			jsonMain()
			self.browserButton.config(state=NORMAL)
			self.generate.config(state=NORMAL)
开发者ID:activatedgeek,项目名称:similaritycheck,代码行数:79,代码来源:process.py

示例11: Application

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack(fill=BOTH, expand=1)
        self.initUI()
        self.setGeometry()
        self.component = NewComponent()

    def setGeometry(self):
        x = 300
        y = 100
        self.master.geometry("400x300+%d+%d" % (x, y))
        self.master.update()


    def initUI(self):
        #setup title
        self.master.title("Component Creator")
        self.style = Style()
        self.style.theme_use("clam")

        #indicator label
        self.labelName = Label(self, text="Component Name:")
        self.labelName.place(x=10, y=10)
        self.master.update()

        # create variable and namefield for input of component name
        sv = StringVar()
        sv.trace("w", lambda name, index, mode, sv=sv: self.nameChanged(sv))
        self.nameField = Entry(self, textvariable=sv)
        self.nameField.place(x=10+self.labelName.winfo_width() + 10, y=10)
        self.master.update()

        # label for image name that will show img name for a given component name
        self.imgNameVar = StringVar()
        self.imgNameVar.set('imageName:')
        self.labelImageName = Label(self, textvariable=self.imgNameVar)
        self.labelImageName.place(x=10+self.labelName.winfo_width()+10,y=40)

        # checkbox for visible component or not
        self.cbVar = IntVar()
        self.cb = Checkbutton(self, text="Visible Component",  variable=self.cbVar)
        self.cb.place(x=10, y=70)

        # dropdown list for category
        self.labelCategory = Label(self, text="Category:")
        self.labelCategory.place(x=10, y=110)
        self.master.update()

        acts = ['UserInterface', 'Layout', 'Media', 'Animation', 'Sensors', 'Social', 'Storage',
                'Connectivity', 'LegoMindStorms', 'Experimental', 'Internal', 'Uninitialized']

        self.catBox = Combobox(self, values=acts)
        self.catBox.place(x=10+self.labelCategory.winfo_width()+10, y=110)

        # button to select icon image
        self.getImageButton = Button(self, text="Select icon", command=self.getImage)
        self.getImageButton.place(x=10, y=150)
        self.master.update()

        # explanation for resizing
        self.resizeVar = IntVar()
        self.resizeCB = Checkbutton(self,
            text="ON=Resize Image (Requires PIL)\nOFF=Provide 16x16 Image", variable=self.resizeVar)
        self.resizeCB.place(x=10+self.getImageButton.winfo_width()+10, y=150)

        # create button
        self.createButton = Button(self, text="Create", command=self.create)
        self.createButton.place(x=10, y=230)

        #cancel button
        self.cancelButton = Button(self, text="Cancel", command=self.quit)
        self.cancelButton.place(x=200, y=230)


    # open file picker for selecting an icon
    def getImage(self):
        ftypes = [('All Picture Files', ('*.jpg', '*.png', '*.jpeg', '*.bmp')), ('All files', '*')]
        self.component.imgFile = askopenfilename(filetypes=ftypes, title="Select an Icon file")

    # update component name and image name for component by lowercasing first letter
    def nameChanged(self, sv):
        s = sv.get()
        self.component.compName = s
        self.component.compImgName = s[:1].lower() + s[1:] if s else ''
        self.imgNameVar.set('imageName: %s' % self.component.compImgName)

    # tries to create component
    def create(self):
        # sets parameters for new component based on input values
        self.component.visibleComponent = bool(self.cbVar.get())
        self.component.resizeImage = bool(self.resizeVar.get())
        self.component.category = self.catBox.get().upper()
        self.component.compName = self.nameField.get()

        try:
            # check if component already exists
            try:
                open('../../components/src/com/google/appinentor/components/runtime/%s.java', 'r')
                tkMessageBox.showerror("Duplicate Component","%s already exists" % self.component.compName)
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:103,代码来源:

示例12: App

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class App(Frame):

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

        self.parent = parent
        self.initUI()
        self.centerWindow()

    def initUI(self):
        self.parent.title("Champion Pool Builder")
        self.parent.iconbitmap("assets/icon.ico")
        self.style = Style()
        self.style.theme_use("default")

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

        self.buildMode = True
        self.allPools = "assets/pools/"

        self.champsLabel = Label(text="Champions")
        self.champBox = Listbox(self)
        self.champBoxScrollbar = Scrollbar(self.champBox, orient=VERTICAL)
        self.champBox.config(yscrollcommand=self.champBoxScrollbar.set)
        self.champBoxScrollbar.config(command=self.champBox.yview)

        self.addButton = Button(self, text=">>", command=self.addChampToPool)
        self.removeButton = Button(self, text="<<", command=self.removeChampFromPool)
        self.saveButton = Button(self, text="Save champion pool", width=18, command=self.saveChampPool)
        self.loadButton = Button(self, text="Load champion pool", width=18, command=lambda: self.loadChampPools(1))
        self.confirmLoadButton = Button(self, text="Load", width=6, command=self.choosePool)
        self.getStringButton = Button(self, text="Copy pool to clipboard", width=18, command=self.buildPoolString)

        self.poolLabel = Label(text="Champion Pool")
        self.poolBox = Listbox(self)
        self.poolBoxScrollbar = Scrollbar(self.poolBox, orient=VERTICAL)
        self.poolBox.config(yscrollcommand=self.poolBoxScrollbar.set)
        self.poolBoxScrollbar.config(command=self.poolBox.yview)

        self.champsLabel.place(x=5, y=5)
        self.champBox.place(x=5, y=30)

        self.addButton.place(x=150, y=60)
        self.removeButton.place(x=150, y=100)
        self.saveButton.place(x=350, y=30)
        self.loadButton.place(x=350, y=60)
        self.getStringButton.place(x=350, y=90)

        self.poolLabel.place(x=200, y=5)
        self.poolBox.place(x=200, y=30)

        self.champBox.focus_set()
        self.loadChampions()

    def centerWindow(self):
        w = 500
        h = 200
        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()
        x = (sw - w)/2
        y = (sh - h)/2
        self.parent.geometry("%dx%d+%d+%d" % (w, h, x, y))

    def loadChampions(self, pooled=None):
        if pooled:
            with open("assets/Champions.txt", "r") as file:
                champions = file.read().splitlines()
            for champ in pooled:
                champions.remove(champ)
            for champion in sorted(champions):
                self.champBox.insert(END, champion)
        else:
            with open("assets/Champions.txt", "r") as file:
                champions = file.read().splitlines()
            for champion in sorted(champions):
                self.champBox.insert(END, champion)

    def choosePool(self):
        idx = self.poolBox.curselection()
        chosenPool = self.poolBox.get(idx)
        self.confirmLoadButton.place_forget()
        self.loadChampPools(2, chosenPool)

    def loadChampPools(self, level, pool=None):
        if level == 1:
            self.buildMode = False
            self.champBox.delete(0, END)
            self.poolBox.delete(0, END)
            self.saveButton.config(state=DISABLED)
            self.loadButton.config(state=DISABLED)
            self.getStringButton.config(state=DISABLED)
            self.confirmLoadButton.place(x=350, y=120)

            with open("assets/champpools.txt", "r") as file:
                champPools = file.read().splitlines()
            for pool in champPools:
                self.poolBox.insert(END, pool)
        elif level == 2:
            self.poolBox.delete(0, END)
            self.buildMode = True
#.........这里部分代码省略.........
开发者ID:HeerRik,项目名称:poolbuilder,代码行数:103,代码来源:poolbuilder.py

示例13: FakeDeviceApp

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class FakeDeviceApp(Frame):
    MIN_X = 0
    MAX_X = 50
    MIN_Y = 0
    MAX_Y = 100
    MIN_Z = 0
    MAX_Z = 200

    def __init__(self, parent):
        Frame.__init__(self, parent, background='white')
        self.parent = parent
        self.init_ui()

    def init_ui(self):
        self.parent.title('Fake Device')
        self.style = Style()
        self.style.theme_use('default')

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

        x_scale = Scale(self, from_=self.MIN_X, to=self.MAX_X, command=self.on_scale_x)
        x_scale.place(x=0, y=0)

        y_scale = Scale(self, from_=self.MIN_Y, to=self.MAX_Y, command=self.on_scale_y)
        y_scale.place(x=0, y=20)

        z_scale = Scale(self, from_=self.MIN_Z, to=self.MAX_Z, command=self.on_scale_z)
        z_scale.place(x=0, y=40)

        angle_scale = Scale(self, from_=0, to=math.pi/2, command=self.on_scale_angle)
        angle_scale.place(x=0, y=80)

        self.x_var = IntVar()
        self.x_label = Label(self, text=0, textvariable=self.x_var)
        self.x_label.place(x=100, y=0)

        self.y_var = IntVar()
        self.y_label = Label(self, text=0, textvariable=self.y_var)
        self.y_label.place(x=100, y=20)

        self.z_var = IntVar()
        self.z_label = Label(self, text=0, textvariable=self.z_var)
        self.z_label.place(x=100, y=40)

        self.angle_var = DoubleVar()
        self.angle_label = Label(self, text=0, textvariable=self.angle_var)
        self.angle_label.place(x=100, y=80)

        self.button = Button(self, text='test', command=self.on_button)
        self.button.place(x=0, y=100)

    def on_button(self):
        print('hello')

    def on_scale_angle(self, val):
        v = float(val)
        self.angle_var.set(v)
        self.update()


    def on_scale_x(self, val):
        v = int(float(val))
        self.x_var.set(v)
        self.update()

    def on_scale_y(self, val):
        v = int(float(val))
        self.y_var.set(v)
        self.update()

    def on_scale_z(self, val):
        v = int(float(val))
        self.z_var.set(v)
        self.update()

    def update(self):
        x = self.x_var.get()
        y = self.y_var.get()
        z = self.z_var.get()
        angle = self.angle_var.get()

        sensor = events.sensor_storage
        sensor.reset()
        if not (x == 0 and y == 0 and z == 0):
            index_pos = [x, y, z]
            sensor.index_finger_pos = index_pos
            sensor.cmd_angle = angle
开发者ID:if1live,项目名称:marika,代码行数:89,代码来源:devices.py

示例14: init_ui

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
    def init_ui(self):
        self.parent.title("Image enhancement")
        self.pack(fill=BOTH, expand=1)
        self.center_window()

        openFileButton = Button(self, text="Choose image", command=self.open_file)
        openFileButton.place(x=50, y=50)

        self.runButton = Button(self, text="Enhance", command=self.run, state="disabled")
        self.runButton.place(x=200, y=50)

        membershipLabel = Label(text="Membership passes:")
        membershipLabel.place(x=50, y=120)
        self.membershipPassScale = LabeledScale(self, from_=1, to=10)
        self.membershipPassScale.place(x=250, y=100)

        intensifyLabel = Label(text="1st intensify passes:")
        intensifyLabel.place(x=50, y=170)
        self.intensifyPassScale = LabeledScale(self, from_=1, to=10)
        self.intensifyPassScale.place(x=250, y=150)

        convolveLabel = Label(text="Convolve:")
        convolveLabel.place(x=50, y=220)
        self.convolveCheckbutton = Checkbutton(self)
        self.convolveCheckbutton.place(x=250, y=220)
        self.convolveCheckbutton.invoke()

        secondIntensifyLabel = Label(text="2nd intensify passes:")
        secondIntensifyLabel.place(x=50, y=270)
        self.secondIntensifyPassScale = LabeledScale(self, from_=1, to=10)
        self.secondIntensifyPassScale.place(x=250, y=250)

        thresholdLabel = Label(text="Threshold:")
        thresholdLabel.place(x=50, y=320)
        self.thresholdScale = LabeledScale(self, from_=1, to=10)
        self.thresholdScale.place(x=250, y=300)
        self.thresholdScale.scale.set(5)

        powerLabel = Label(text="Power:")
        powerLabel.place(x=50, y=370)
        self.powerScale = LabeledScale(self, from_=2, to=5)
        self.powerScale.place(x=250, y=350)
开发者ID:michalswietochowski,项目名称:PSZT-13L,代码行数:44,代码来源:gui.py

示例15: AppGui

# 需要导入模块: from ttk import Label [as 别名]
# 或者: from ttk.Label import place [as 别名]
class AppGui(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.init_ui()

    def run(self):
        while True:
            tmpPath = "%s-%05d.png" % (os.path.splitext(self.path)[0], randint(1, 99999))
            if not os.path.exists(tmpPath):
                break
        mem = int(self.membershipPassScale.scale.get())
        ins = int(self.intensifyPassScale.scale.get())
        con = self.convolveCheckbutton.instate(['selected'])
        in2 = int(self.secondIntensifyPassScale.scale.get())
        thr = float(int(self.thresholdScale.scale.get())) / 10
        pow = int(self.powerScale.scale.get())

        process_image(self.path, tmpPath, mem, ins, con, in2, thr, pow)

        f = pylab.figure()
        for n, fname in enumerate((tmpPath, self.path)):
            image = Image.open(fname).convert("L")
            arr = np.asarray(image)
            f.add_subplot(1, 2, n)
            pylab.imshow(arr, cmap=cm.Greys_r)
        if con:
            pylab.title("membership passes=%d, 1st intensify passes=%d, convolve=Yes, 2nd intensify passes=%d, "
                        "threshold=%0.1f, power=%d" % (mem, ins, in2, thr, pow))
        else:
            pylab.title("membership passes=%d, 1st intensify passes=%d, convolve=No, "
                        "threshold=%0.1f, power=%d" % (mem, ins, thr, pow))
        pylab.show()

    def open_file(self):
        self.path = tkFileDialog.askopenfilename(parent=self, filetypes=[("PNG Images", "*.png")])
        if self.path != '':
            self.preview_input_file(self.path)
            self.runButton.configure(state="normal")
        else:
            tkMessageBox.showerror("Error", "Could not open file")

    def preview_input_file(self, path):
        self.img = Image.open(path)
        imgTk = ImageTk.PhotoImage(self.img)
        self.label = Label(image=imgTk)
        self.label.image = imgTk
        self.label.place(x=400, y=50, width=self.img.size[0], height=self.img.size[1])

    def center_window(self):
        w = 1024
        h = 600
        x = (self.parent.winfo_screenwidth() - w) / 2
        y = (self.parent.winfo_screenheight() - h) / 2
        self.parent.geometry("%dx%d+%d+%d" % (w, h, x, y))

    def init_ui(self):
        self.parent.title("Image enhancement")
        self.pack(fill=BOTH, expand=1)
        self.center_window()

        openFileButton = Button(self, text="Choose image", command=self.open_file)
        openFileButton.place(x=50, y=50)

        self.runButton = Button(self, text="Enhance", command=self.run, state="disabled")
        self.runButton.place(x=200, y=50)

        membershipLabel = Label(text="Membership passes:")
        membershipLabel.place(x=50, y=120)
        self.membershipPassScale = LabeledScale(self, from_=1, to=10)
        self.membershipPassScale.place(x=250, y=100)

        intensifyLabel = Label(text="1st intensify passes:")
        intensifyLabel.place(x=50, y=170)
        self.intensifyPassScale = LabeledScale(self, from_=1, to=10)
        self.intensifyPassScale.place(x=250, y=150)

        convolveLabel = Label(text="Convolve:")
        convolveLabel.place(x=50, y=220)
        self.convolveCheckbutton = Checkbutton(self)
        self.convolveCheckbutton.place(x=250, y=220)
        self.convolveCheckbutton.invoke()

        secondIntensifyLabel = Label(text="2nd intensify passes:")
        secondIntensifyLabel.place(x=50, y=270)
        self.secondIntensifyPassScale = LabeledScale(self, from_=1, to=10)
        self.secondIntensifyPassScale.place(x=250, y=250)

        thresholdLabel = Label(text="Threshold:")
        thresholdLabel.place(x=50, y=320)
        self.thresholdScale = LabeledScale(self, from_=1, to=10)
        self.thresholdScale.place(x=250, y=300)
        self.thresholdScale.scale.set(5)

        powerLabel = Label(text="Power:")
        powerLabel.place(x=50, y=370)
        self.powerScale = LabeledScale(self, from_=2, to=5)
        self.powerScale.place(x=250, y=350)
开发者ID:michalswietochowski,项目名称:PSZT-13L,代码行数:100,代码来源:gui.py


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