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


Python Gui.en方法代码示例

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


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

示例1: display

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]
def display():
	def display_QR():
		qr_bitstring = polynomials.QRbitstring(entry.get().upper())
		i = 0
		for i in range(8):
			canvas = mygui.ca(width=300, height=300)
			canvas.config(bg='white')
			g = Mask(i, qr_bitstring)
			g.drawSquares(canvas)
	

	g = Mask(0, qr_bitstring)

	mygui = Gui()
	mygui.title('QR Encoder')
	label = mygui.la(text='Enter the text to encode here:')
	entry = mygui.en()
	button = mygui.bu(text='Make QR Code', command=display_QR)
	mygui.gr(cols=4)
	mygui.mainloop()
开发者ID:JNazare,项目名称:QR_Encoder,代码行数:22,代码来源:QR_with_classes.py

示例2: callback1

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]
g.title('circle demo')
canvas = g.ca(width=500, height=500, bg='white')
circle = None

def callback1():
    """called when the user presses 'create circle' """
    global circle
    circle = canvas.circle([0,0], 100)

def callback2():
    """called when the user presses 'Change color' """

    # if the circle hasn't been created yet, do nothing
    if circle == None:
        return 

    # get the text from the entry and try to change the circle's color
    color = entry.get()
    try:
        circle.config(fill=color)
    except TclError:
        # probably an unknown color name
        print(message)

# create the widgets
g.bu(text='Create circle', command=callback1)
entry = g.en()
g.bu(text='Change color', command=callback2)

g.mainloop()
开发者ID:ErikRHanson,项目名称:think_python,代码行数:32,代码来源:ex03_circle2.py

示例3: Gui

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]
from Gui import *

g = Gui()
g.title('Gui Title')

# 1ST kind of TEXT
entry = g.en(text='Default text.')

# 2ND kind of TEXT
text = g.te(width=100, height=5)

text.insert(END, 'abc')
text.insert(1.1, 'xyz') # row.column

# Get function:
# text.get(0.0, END)
# text.delete(1.2, END)

g.mainloop()
开发者ID:flake123p,项目名称:ProjectH,代码行数:21,代码来源:test.py

示例4: insert

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]
def insert(obj):
	cal_in.insert(END,obj)

def delete(p):
	cal_in.delete(p)
	print p,len(cal_in.get())-1,cal_in.get()

from Gui import *

cal=Gui()
cal.title('Calculator')

cal_in = cal.en(width=35)

cal.row()
cal.gr(cols=6)

seven = cal.bu(text='7',command = Callable(insert,'7'))
eight = cal.bu(text='8',command = Callable(insert,'8'))
nine = cal.bu(text='9',command = Callable(insert,'9'))
div = cal.bu(text='/',command = Callable(insert,'/'))

#bspace = cal.bu(text='Del',command = Callable(delete,0))
bspace = cal.bu(text='Del',command = Callable(delete,len(cal_in.get())-1))

clr = cal.bu(text='Clr',command = Callable(delete,'7'))

four = cal.bu(text='4',command = Callable(insert,'4'))
five = cal.bu(text='5',command = Callable(insert,'5'))
six = cal.bu(text='6',command = Callable(insert,'6'))
mul = cal.bu(text='*',command = Callable(insert,'*'))
开发者ID:binoytv9,项目名称:Think-Python-by-Allen-B-Downey--Exercises,代码行数:33,代码来源:cal.py

示例5: create_circle

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]


def create_circle():
	global item
	item = c.circle([0,0],100,fill='red')

def change_color():
	try:
		if 'item' in globals():
			item.config(fill=entry.get())
		else:
			g.la(text='First create a circle!!!')
			return
	except :
		g.la(text='Invalid color')
		

from Gui import *

g = Gui()
b1 = g.bu(text='Press to create a circle',command=create_circle)
c = g.ca(width=500,height=500)

entry=g.en(text='enter the color')
b2 = g.bu(text='Press to change color of circle',command=change_color)



g.mainloop()
开发者ID:binoytv9,项目名称:Think-Python-by-Allen-B-Downey--Exercises,代码行数:31,代码来源:3.py

示例6: Panel2

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]
class Panel2(Thread):
	def __init__(self,field):
		Thread.__init__(self)
		self.field=field
		self.field.panel=self
		self.activeCharge=None
		self.sel=None
		self.g=None

	def run(self):
		self.g=Gui()
		self.g.title('Control Panel')

		#charge
		self.chgla=self.g.la(text='Charge')
		self.g.gr(cols=3)
		minus=self.g.bu(text='-', command=Callable(self.addC, -1))
		self.chg=self.g.en()
		plus=self.g.bu(text='+', command=Callable(self.addC, 1))
		self.g.endgr()

		#position
		self.pos=self.g.la(text='Position')
		self.g.gr(cols=3)
		xla=self.g.la(text='x')
		yla=self.g.la(text='y')
		zla=self.g.la(text='z')
		self.x=self.g.en(text='')
		self.y=self.g.en(text='')
		self.z=self.g.en(text='')
		self.g.endgr()
		#menu
		self.men=self.g.mb(text='Change/ Add Charge')
		hi=self.g.mi(self.men, text='Add point charge', command=Callable(self.addPoint))
		self.g.mi(self.men, text='Add line charge', command=Callable(self.addLine))
		self.g.mi(self.men, text='Find voltage at point', command=self.findVolt)

		
		#add
		self.g.row([1,1])
		self.add=self.g.bu(text='Add')
		self.rem=self.g.bu(text='Delete', command=self.remove)
		self.g.endrow()
		#self.g.bu(text='Quit', command=self.end)
		
		self.disp=self.g.mb(text='Voltage Field')
		self.g.mi(self.disp, text='Voltage Field', command=self.showv)
		self.g.mi(self.disp, text='Electric Field', command=self.showe)
		#ans
		self.ans=self.g.la(text='')

		
		self.field.start()
		for chrg in self.field.charges:
			chrg.makeMi()
		self.g.mainloop()
		
	def showv(self):
		self.disp.config(text='Voltage Field')
		self.actf=self.field.vfield
		self.acte=self.field.vdots
		self.field.change=True
		for p in self.field.earrows:
			self.field.earrows[p].visible=False
		for p in self.field.vdots:
			self.field.vdots[p].visible=True
	def showe(self):
		self.disp.config(text='Electric Field')
		self.field.actf=self.field.efield
		self.field.acte=self.field.earrows
		self.field.change=True
		for p in self.field.earrows:
			self.field.earrows[p].visible=True
		for p in self.field.vdots:
			self.field.vdots[p].visible=False
		
	def addPoint(self):
		self.men.config(text='Add Point')
		self.pos.config(text='Position')
		self.add.config(command=Callable(self.addPCharge))
		
	def addLine(self):
		self.men.config(text='Add Line')
		self.pos.config(text='Equation in terms of t')
		self.add.config(command=Callable(self.addLCharge))
		self.field.change=True
		
	def addPCharge(self):
		pos=(int(self.x.get()), int(self.y.get()), int(self.z.get()))
		c=float(self.chg.get())
		p=Point(pos=pos, charge=c)
		self.addCharge(p)

	def addLCharge(self):
		eqn=(self.x.get(), self.y.get(), self.z.get())
		dens=self.chg.get()
		p=Line(eqn=eqn, density=dens)
		self.addCharge(p)


#.........这里部分代码省略.........
开发者ID:berit,项目名称:Project-E-and-M,代码行数:103,代码来源:control.py

示例7: Gui

# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import en [as 别名]
    error_window.title('Error')
    error_window.la('')
    error_window.gr(cols=3)
    error_window.la('    ')
    error_window.la('Error with your inputs')
    error_window.la('    ')
    error_window.endgr()
    error_window.la('')

if gui_present:
    main_window = Gui()
    main_window.title('Attenuation and ABV Calculator')
    main_window.la('')
    main_window.gr(cols=3)
    main_window.la('Original Gravity:')
    original_gravity = main_window.en(text='')
    main_window.la('    ')
    main_window.la('Ending Gravity:')
    final_gravity = main_window.en(text='')
    main_window.la('    ')
    main_window.endgr()
    main_window.la('')
    main_window.gr(cols=3)
    main_window.la('    ')
    main_window.bu(text='Calculate Attenuation and ABV', command=results_controller)
    main_window.la('    ')
    main_window.endgr()
    main_window.la('')
    main_window.gr(cols=3)
    main_window.la('Attenuation:')
    attenuation = main_window.en(text='')
开发者ID:mjbondra,项目名称:python-abv-calculator,代码行数:33,代码来源:abv.py


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