本文整理汇总了Python中System.Windows.Forms.Button类的典型用法代码示例。如果您正苦于以下问题:Python Button类的具体用法?Python Button怎么用?Python Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, curveId):
offset = 10
self.Text = "Annotate Curve"
crvlabel = Label(Text="Curve ID = "+str(curveId), AutoSize=True)
self.Controls.Add(crvlabel)
width = crvlabel.Right
pt = Point(crvlabel.Left,crvlabel.Bottom + offset)
labelstart = Label(Text="Text at start", AutoSize=True)
labelstart.Location = pt
self.Controls.Add(labelstart)
pt.X = labelstart.Right + offset
inputstart = TextBox(Text="Start")
inputstart.Location = pt
self.Controls.Add(inputstart)
if( inputstart.Right > width ):
width = inputstart.Right
self.m_inputstart = inputstart
pt.X = labelstart.Left
pt.Y = labelstart.Bottom + offset*3
buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK)
buttonApply.Location = pt
self.Controls.Add(buttonApply)
pt.X = buttonApply.Right + offset
buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel)
buttonCancel.Location = pt
self.Controls.Add(buttonCancel)
if( buttonCancel.Right > width ):
width = buttonCancel.Right
self.ClientSize = Size(width, buttonCancel.Bottom)
self.AcceptButton = buttonApply
self.CancelButton = buttonCancel
示例2: __init__
def __init__(self):
self.Text = 'Buttons'
self.Size = Size(WIDTH, HEIGHT)
ok = Button()
PANEL_HEIGHT = ok.Height + PANEL_SPACE
panel = Panel()
panel.Height = PANEL_HEIGHT
panel.Dock = DockStyle.Bottom
panel.Parent = self
x = ok.Width * 2 + BUTTONS_SPACE
y = (PANEL_HEIGHT - ok.Height) / 2
ok.Text = "Ok"
ok.Parent = panel
ok.Location = Point(WIDTH-x, y)
ok.Anchor = AnchorStyles.Right
close = Button()
x = close.Width
close.Text = "Close"
close.Parent = panel
close.Location = Point(WIDTH-x-CLOSE_SPACE, y)
close.Anchor = AnchorStyles.Right
self.CenterToScreen()
示例3: __init__
def __init__(self):
self.m_testport = 'COM3' #: Port on test system
self.m_test_meter = "300001162" #: Test V4 meter
ekm_set_log(ekm_print_log)
print "\n****\nInitializing v3 and v4 for db test"
self.Text = 'Sample EKM Iron Python App'
self.label = Label()
self.label.Text = "0.0"
self.label.Location = Point(50, 50)
self.label.Height = 30
self.label.Width = 200
self.count = 0
button = Button()
button.Text = "Read Meter: " + self.m_test_meter
button.Location = Point(50, 100)
button.Width = 180
button.Click += self.buttonPressed
self.Controls.Add(self.label)
self.Controls.Add(button)
示例4: __init__
def __init__(self, watcher=None):
#
self.__watcher = watcher
self.Text = "FileWatcher configuration"
self.__table = TableLayoutPanel()
self.MinimumSize = Size(520, 360)
self.Size = Size(640, 360)
self.MaximizeBox = False
self.Icon = Icon("watcher.ico")
p = Panel()
p.Padding = Padding(10, 0, 10, 10)
exitBut = Button(Text="E&xit")
p.Height = exitBut.Height + 10
p.Controls.Add(exitBut)
exitBut.Dock = DockStyle.Right
p.Dock = DockStyle.Bottom
def exit(s, e):
self.Dispose()
exitBut.Click += exit
self.Controls.Add(p)
self.Controls.Add(self.__table)
label = Label(Text="Watch Directories")
self.__table.Controls.Add(label)
self.__list = ListBox()
self.__list.Width = 500
self.__table.Dock = DockStyle.Fill
try:
for wd in watcher.controller.watchDirectories.itervalues():
self.__list.Items.Add(wd)
except Exception, e:
self.__list.Items.Add(str(e))
示例5: __build_okbutton
def __build_okbutton(self):
''' builds and returns the ok button for this form '''
button = Button()
button.DialogResult = DialogResult.OK
button.Location = Point(228, 343)
button.Size = Size(80, 23)
button.Text = i18n.get("ConfigFormOK")
return button
示例6: __build_skipbutton
def __build_skipbutton(self):
''' builds and return the skip button for this form '''
button = Button()
button.DialogResult = DialogResult.Ignore
button.Location = Point(110, 362)
button.Size = Size(90, 24)
button.Text = i18n.get("SeriesFormSkip")
return button
示例7: __build_okbutton
def __build_okbutton(self):
''' builds and returns the ok button for this form '''
button = Button()
button.DialogResult = DialogResult.OK
button.Location = Point(15, 362)
button.Size = Size(90, 24)
button.Text = i18n.get("SeriesFormOK")
return button
示例8: __build_restore_button
def __build_restore_button(self):
''' builds and returns the restore button for this form '''
button = Button()
button.Click += self.__fired_restore_defaults
button.Location = Point(10, 343)
button.Size = Size(170, 23)
button.Text = i18n.get("ConfigFormRestore")
return button
示例9: __build_cancel_button
def __build_cancel_button(self):
''' builds and returns the cancel button for this form '''
button = Button()
button.DialogResult = DialogResult.Cancel
button.Location = Point(315, 343)
button.Size = Size(90, 23)
button.Text = i18n.get("ConfigFormCancel")
return button
示例10: __build_okbutton
def __build_okbutton(self):
""" builds and returns the ok button for this form """
button = Button()
button.DialogResult = DialogResult.OK
button.Location = Point(223, 362) if self.__config.show_covers_b else Point(10, 362)
button.Size = Size(90, 24)
button.Text = i18n.get("IssueFormOK")
return button
示例11: __build_skipbutton
def __build_skipbutton(self):
""" builds and returns the skip button for this form """
button = Button()
button.DialogResult = DialogResult.Ignore
button.Location = Point(318, 362) if self.__config.show_covers_b else Point(105, 362)
button.Size = Size(90, 24)
button.Text = i18n.get("IssueFormSkip")
return button
示例12: __build_backbutton
def __build_backbutton(self):
""" builds and returns the back button for this form """
button = Button()
button.DialogResult = DialogResult.Retry
button.Location = Point(595, 362)
button.Size = Size(125, 24)
button.Text = i18n.get("IssueFormGoBack")
return button
示例13: __build_issuesbutton
def __build_issuesbutton(self):
''' builds and return the 'show issues' button for this form '''
button = Button()
button.DialogResult = DialogResult.Yes
button.Location = Point(395, 362) \
if self.__config.show_covers_b else Point(605, 362)
button.Size = Size(115, 24)
button.Text = i18n.get("SeriesFormIssues")
return button
示例14: __build_searchbutton
def __build_searchbutton(self):
''' builds and return the 'search again' button for this form '''
button = Button()
button.DialogResult = DialogResult.Retry
button.Location = Point(275, 362) \
if self.__config.show_covers_b else Point(485, 362)
button.Size = Size(115, 24)
button.Text = i18n.get("SeriesFormAgain")
return button
示例15: __build_settingsbutton
def __build_settingsbutton(self):
''' Builds and returns the settings button for this form. '''
button = Button()
button.Click += self.__show_configform
button.Location = Point(208, 68)
button.Size = Size(100, 23)
button.Text = i18n.get("WelcomeFormSettings")
button.UseVisualStyleBackColor = True
return button