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


Python Graphics.centerWindow方法代码示例

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


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

示例1: runWin

# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import centerWindow [as 别名]
def runWin(progress=0):

	MainWin = Toplevel(root)

	# Window setup
	MainWin.wm_title("BigRep Printer Configuration")

	#Makes window the size of the screen.
	MainWin.minsize(width=MainWin.winfo_screenwidth(), height=MainWin.winfo_screenheight())

	MainWin.protocol('WM_DELETE_WINDOW', cleanUp)

	Label(MainWin, image=photo).grid(row=0, column=1)

	Label(MainWin, text="Configuration UI", font=Graphics.getBigRepFont(MainWin, 50)).grid(row=0, column = 2)
	

	# Gets the configuration file by its name and updates the measurement value by its parameter. 
	# Should be called when doc is exported to pdf/process is completed. 
	# OR: Part of testing & needs to be called immediately?
	def updateValueInFile(value):

		filename = ""

		target = open(filename, 'r')

		contents = target.read()

		target.close()

		# Update with actual contents
		toFind = ""

		# Code to find & modify spot in file
		index = contents.find(toFind, beg=0, end=len(toFind))

		contents = contents[:index] + value + contents[index + len(toFind):]

		# Overwrite file
		target = open(filename, 'w')

		target.write(contents)

	tasks = TaskClass.tasks[progress:progress+TaskClass.groupSize]

	contentFields = []

	# Code to finish up progress when finished with all tasks.
	if len(tasks) == 0:
		print 'Done with tasks!'
		cleanUp()
		sys.exit()

	# Create window layout as grid
	for r in range(len(tasks)):
		row = r+1
		label = Label(MainWin, text=tasks[r].label).grid(row=row,column=1, sticky=W)
		content = Entry(MainWin, width=40)
		content.grid(row=row, column=2, sticky=W)
		content.insert(0, tasks[r].content)
		contentFields += [content]
		#MainWin.rowconfigure(r, minsize=MainWin.winfo_height/len(tasks))
	    #MainWin.columnconfigure(1, minsize=MainWin.winfo_width/2)

	def onButtonClick():
		print 'Button clicked!'
		for num in range(0, TaskClass.groupSize-1):
			TaskClass.tasks[progress + num] = contentFields[num].get()
		MainWin.destroy()
		runWin(progress+2)
	
	button = Button(MainWin, text="Next", command=onButtonClick)
	button.grid(row=progress+TaskClass.groupSize+1, column=2, sticky = W)
	
	for c in range(2):
		MainWin.columnconfigure(c, minsize=100)
	
	Graphics.centerWindow(MainWin)
开发者ID:jonasalexander,项目名称:configUI,代码行数:80,代码来源:Main.py

示例2: Label

# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import centerWindow [as 别名]
authWin.title("Authentication")
authWin.minsize(width=222, height=222)
welcomeLabel = Label(authWin, text="WELCOME TO THE BIGREP CONFIGURATION \n GRAPHICAL USER INTERFACE", font=Graphics.getBigRepFont(authWin, 30))
welcomeLabel.grid(row=0, column=0, sticky=N, columnspan=4, pady=20, padx=20)

passwordPrompt = Label(authWin, text="Input password to unlock: ")
passwordPrompt.grid(row=1, column=0, pady=50, sticky=W, padx=20)
passwordField = Entry(authWin, width=40)
#TD: Make entry secret
passwordField.grid(row=1, column=1, padx=10, pady=5)
submitButton = Button(authWin, text="Login", command=submitPassword)
submitButton.grid(row=1, column=3, sticky=W, padx= 20)
authWin.protocol('WM_DELETE_WINDOW', cleanUp)

Graphics.centerWindow(authWin)

# TD: Should submit when return key hit.
# authWin.bind("<Return>", submitPassword())
	
# How to save progress in case window closed, device crashes???
''' 
Save a text file with SOMENAME (like Backup or so) and date & time stamp.
When starting program, look for file with SOMENAME (and most recent date) 
and load data from there into UI.
'''
#This is the image of BigRep's logo that will be displayed in every window.
photo = PhotoImage(file="Logo.pgm").subsample(5)

# Create log of logins
开发者ID:jonasalexander,项目名称:configUI,代码行数:31,代码来源:Main.py


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