本文整理汇总了Python中breezypythongui.EasyFrame类的典型用法代码示例。如果您正苦于以下问题:Python EasyFrame类的具体用法?Python EasyFrame怎么用?Python EasyFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EasyFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
"""Sets up the window and widgets."""
EasyFrame.__init__(self)
# Label and field for the input
self.addLabel(text = "An integer",
row = 0, column = 0)
self.inputField = self.addIntegerField(value = 0,
row = 0,
column = 1,
width = 10)
# Label and field for the output
self.addLabel(text = "Square root",
row = 1, column = 0)
self.outputField = self.addFloatField(value = 0.0,
row = 1,
column = 1,
width = 8,
precision = 2,
state = "readonly")
# The command button
self.addButton(text = "Compute", row = 2, column = 0,
columnspan = 2, command = self.computeSqrt)
示例2: __init__
def __init__(self, model):
"""Sets up the view. The model comes in as an argument."""
EasyFrame.__init__(self, title = "Temperature Converter")
self.model = model
# Label and field for Celsius
self.addLabel(text = "Celsius", row = 0, column = 0)
self.celsiusField = self.addFloatField(value =
model.getCelsius(),
row = 1,
column = 0,
precision = 2)
# Label and field for Fahrenheit
self.addLabel(text = "Fahrenheit", row = 0, column = 1)
self.fahrField = self.addFloatField(value =
model.getFahrenheit(),
row = 1,
column = 1,
precision = 2)
# Celsius to Fahrenheit button
self.addButton(text = ">>>>",
row = 2, column = 0,
command = self.computeFahr)
# Fahrenheit to Celsius button
self.addButton(text = "<<<<",
row = 2, column = 1,
command = self.computeCelsius)
示例3: __init__
def __init__(self):
"""Sets up the window and widgets."""
EasyFrame.__init__(self, title = "Sphere Attributes")
# Label and field for the radius
self.addLabel(text = "Radius",
row = 0, column = 0)
self.radiusField = self.addFloatField(value = 0.0,
row = 0,
column = 1)
# Label and field for the output
self.outputLabel = self.addLabel(text = "Diameter",
row = 1, column = 0)
self.outputField = self.addFloatField(value = 0.0,
row = 1,
column = 1)
# The command buttons
self.addButton(text = "Diameter",
row = 2, column = 0,
command = self.computeDiameter)
self.addButton(text = "Area",
row = 2, column = 1,
command = self.computeArea)
self.addButton(text = "Volume",
row = 2, column = 2,
command = self.computeVolume)
示例4: __init__
def __init__(self):
"""Sets up the window and widgets."""
EasyFrame.__init__(self, "Market Simulator")
self.addLabel(text = "Total running time",
row = 0, column = 0)
self.addLabel(text = "Average processing time per customer",
row = 1, column = 0)
self.addLabel(text = "Probablity of new arrival",
row = 2, column = 0)
self.addLabel(text = "Number of cashiers",
row = 3, column = 0)
self.addLabel(text = "Results",
row = 5, column = 0, columnspan = 2, sticky = "NSEW")
self.runTimeFld = self.addIntegerField(value = 0, width = 5,
row = 0, column = 1)
self.aveTimeFld = self.addIntegerField(value = 0, width = 5,
row = 1, column = 1)
self.probabilityFld = self.addFloatField(value = 0.0, width = 5,
row = 2, column = 1)
self.cashiersFld = self.addIntegerField(value = 0, width = 5,
row = 3, column = 1)
self.outputArea = self.addTextArea("", row = 6, column = 0,
columnspan = 2,
width = 40, height = 10)
self.runBtn = self.addButton(text = "Run", row = 4, column = 0,
columnspan = 2,
command = self.run)
示例5: __init__
def __init__(self, number, myPort, otherPort):
"""Sets up the window and widgets."""
EasyFrame.__init__(self, title = "Message App " + str(number))
# Label and field for the input
self.addLabel(text = "Input",
row = 0, column = 0)
self.inputField = self.addTextField(text = "",
row = 0,
column = 1)
# Text area for the output
self.outputArea = self.addTextArea(text = "",
row = 1,
column = 0,
columnspan = 2,
width = 50, height = 15)
# The command button
self.button = self.addButton(text = "Send",
row = 2, column = 0,
columnspan = 2,
command = self.sendMessage)
# Set up and start the message server for this window
myAddress = ('localhost', myPort)
self.otherAddress = ('localhost', otherPort)
myServer = MessageServer(self, myAddress)
myServer.start()
示例6: __init__
def __init__(self):
"""Sets up the window and widgets."""
EasyFrame.__init__(self, "Menu Demo")
# Add the menu bar for the two menus
menuBar = self.addMenuBar(row = 0, column = 0, columnspan = 2)
# Add the File menu
fileMenu = menuBar.addMenu("File")
# Add the command options for the File menu
newMenuCommand = fileMenu.addMenuItem("New", self.newSelected)
openMenuCommand = fileMenu.addMenuItem("Open", self.openSelected)
saveMenuCommand = fileMenu.addMenuItem("Save", self.saveSelected)
# Add the Edit menu
editMenu = menuBar.addMenu("Edit")
# Add the command options for the Edit menu
copyMenuCommand = editMenu.addMenuItem("Copy", self.copySelected)
cutMenuCommand = editMenu.addMenuItem("Cut", self.cutSelected)
pasteMenuCommand = editMenu.addMenuItem("Paste", self.pasteSelected)
# Output field for the results
self.output = self.addTextField("", row = 1, column = 0)
示例7: __init__
def __init__(self, model):
"""Sets up the window and widgets."""
self.model = model
EasyFrame.__init__(self, "ER Scheduler")
self.addLabel(text = "Patient name",
row = 0, column = 0)
self.nameFld = self.addTextField(text = "",
row = 0, column = 1)
self.conditionGrp = self.addRadiobuttonGroup(row = 1, column = 0)
selectedBtn = self.conditionGrp.addRadiobutton("Fair condition")
self.conditionGrp.addRadiobutton("Serious condition")
self.conditionGrp.addRadiobutton("Critical condition")
self.conditionGrp.setSelectedButton(selectedBtn)
self.addButton(text = "Schedule patient", row = 1, column = 1,
rowspan = 3, command = self.schedule)
self.addLabel(text = "Current activity", row = 4, column = 0,
columnspan = 2, sticky = "NSEW")
self.outputArea = self.addTextArea("", row = 5, column = 0,
columnspan = 2,
width = 40, height = 10)
self.treatNextBtn = self.addButton(text = "Treat next",
row = 6, column = 0,
command = self.treatNext,
state = "disabled")
self.treatAllBtn = self.addButton(text = "Treat all",
row = 6, column = 1,
command = self.treatAll,
state = "disabled")
示例8: __init__
def __init__(self):
"""Creates the war game, and sets up the Images and labels
for the two cards to be displayed, the state label,
and the command button."""
EasyFrame.__init__(self, title = "Let's play War!")
self.setSize(350, 350)
self.game = WarGame()
self.game.deal()
self.playerLabel1 = self.addLabel(row = 0, column = 0,
text = "Player 1")
self.playerLabel2 = self.addLabel(row = 0, column = 1,
text = "Player 2")
self.image1 = PhotoImage(file = Card.BACK_NAME)
self.image2 = PhotoImage(file = Card.BACK_NAME)
self.cardImageLabel1 = self.addLabel("", row = 1, column = 0)
self.cardImageLabel1["image"] = self.image1
self.cardImageLabel2 = self.addLabel("", row = 1, column = 1)
self.cardImageLabel2["image"] = self.image2
self.stateLabel = self.addLabel("", row = 2, column = 0,
columnspan = 2)
self.nextCardButton = self.addButton(row = 3, column = 0,
text = "Next card",
command = self.nextCard)
self.newGameButton = self.addButton(row = 4, column = 0,
text = "New Game",
state = "disabled",
command = self.newGame)
示例9: __init__
def __init__(self):
"""Sets up the window and the widgets."""
EasyFrame.__init__(self, title = "Song Browser",
width = 300, height = 150)
# Create a model
self.database = SongDatabase()
self.selectedTitle = None
# Set up the menus
menuBar = self.addMenuBar(row = 0, column = 0, columnspan = 2)
fileMenu = menuBar.addMenu("File")
fileMenu.addMenuItem("Open", self.openFile)
fileMenu.addMenuItem("Save", self.saveFile)
fileMenu.addMenuItem("Save As...", self.saveFileAs)
self.editMenu = menuBar.addMenu("Edit", state = DISABLED)
self.editMenu.addMenuItem("Find", self.findSong)
self.editMenu.addMenuItem("Delete", self.deleteSong)
# Set up the list box
self.listBox = self.addListbox(row = 1, column = 0, width = 20,
listItemSelected = self.listItemSelected)
# Set the text area
self.outputArea = self.addTextArea("", row = 1, column = 1,
width = 30, height = 4)
示例10: __init__
def __init__(self):
"""Sets up the calculator app."""
EasyFrame.__init__(self, "Calculator App", background = "black",
resizable = False)
self.calculator = Calculator()
self.operatorEntered = False
self.mainLabel = self.addLabel ("0", row = 0, column = 0,
columnspan = 4, sticky = "E",
background = "black", foreground = "white")
self.clearButton = self.addButton ("AC", row = 1, column = 0,
command = self.clearLabel)
self.signButton = self.addButton ("+/-", row = 1, column = 1,
command = self.changeSign)
self.percentButton = self.addButton ("%", row = 1, column = 2)
self.divideButton = self.addButton ("/", row = 1, column = 3,
command = self.makeOperatorCommand("/"))
self.multiplyButton = self.addButton ("x", row = 2, column = 3,
command = self.makeOperatorCommand("*"))
self.subtractButton = self.addButton ("-", row = 3, column = 3,
command = self.makeOperatorCommand("-"))
self.additionButton = self.addButton ("+", row = 4, column = 3,
command = self.makeOperatorCommand("+"))
self.equalsButton = self.addButton ("=", row = 5, column = 3,
command = self.makeOperatorCommand("="))
self.decimalButton = self.addButton (".", row = 5, column = 2,
command = self.addDecimal)
self.zeroButton = self.addButton ("0", row = 5, column = 0,
command = self.addZero)
digit = 9
for row in range (2,5):
for column in range (0,3):
numberButton = self.addButton(str(digit), row, column)
numberButton["command"] = self.makeCommand(str(digit))
digit -= 1
示例11: __init__
def __init__(self):
"""Sets up the window and the widgets."""
EasyFrame.__init__(self, title = "List Box Demo",
width = 300, height = 150)
# Set up the list box
self.listBox = self.addListbox(row = 0, column = 0, rowspan = 4,
listItemSelected = self.listItemSelected)
# Add some items to the list box and select the first one
self.listBox.insert(END, "Apple")
self.listBox.insert(END, "Banana")
self.listBox.insert(END, "Cherry")
self.listBox.insert(END, "Orange")
self.listBox.setSelectedIndex(0)
# Set up the labels, fields, and buttons
self.addLabel(text = "Input", row = 0, column = 1)
self.addLabel(text = "Index", row = 1, column = 1)
self.addLabel(text = "Current item", row = 2, column = 1)
self.inputField = self.addTextField(text = "", row = 0,
column = 2, width = 10)
self.indexField = self.addIntegerField(value = "", row = 1,
column = 2, width = 10)
self.itemField = self.addTextField(text = "", row = 2,
column = 2, width = 10)
self.addButton(text = "Add", row = 3,
column = 1, command = self.add)
self.removeButton = self.addButton(text = "Remove", row = 3,
column = 2, command = self.remove)
# Display current index and currently selected item
self.listItemSelected(0)
示例12: __init__
def __init__(self):
"""Sets up the window and the labels."""
EasyFrame.__init__(self)
self.addLabel(text = "(0, 0)", row = 0, column = 0, sticky = "NSEW")
self.addLabel(text = "(0, 1)", row = 0, column = 1, sticky = "NSEW")
self.addLabel(text = "(1, 0)", row = 1, column = 0, sticky = "NSEW")
self.addLabel(text = "(1, 1)", row = 1, column = 1, sticky = "NSEW")
示例13: __init__
def __init__(self):
"""Sets up the window and widgets."""
EasyFrame.__init__(self, title = "Mouse Demo 2")
# Canvas
self.shapeCanvas = ShapeCanvas(self)
self.addCanvas(self.shapeCanvas, row = 0, column = 0,
width = 300, height = 150)
示例14: __init__
def __init__(self):
"""Sets up the window and the labels."""
EasyFrame.__init__(self, "NineCells")
for x in range (0,3):
for y in range (0,3):
labelText = "(" + str(x) + "," + str(y) + ")"
self.addLabel (text = labelText, row = y , column = x,
sticky = "NSEW")
示例15: __init__
def __init__(self, bank):
"""Initialize the frame and establish the data model."""
EasyFrame.__init__(self, title = "Bank Management",
background = BankManager.COLOR)
self.bank = bank
self.accountPosition = None
self.create_widgets()
self.displayAccount()