本文整理汇总了Python中wx.Button方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Button方法的具体用法?Python wx.Button怎么用?Python wx.Button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.Button方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
self.SetBackgroundColour('#ffffff')
self.ok_button = wx.Button(self, wx.ID_OK, label='Ok')
self.datepicker = wx.DatePickerCtrl(self, style=wx.DP_DROPDOWN)
vertical_container = wx.BoxSizer(wx.VERTICAL)
vertical_container.AddSpacer(10)
vertical_container.Add(wx_util.h1(self, label='Select a Date'), 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
vertical_container.Add(self.datepicker, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(10)
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
button_sizer.AddStretchSpacer(1)
button_sizer.Add(self.ok_button, 0)
vertical_container.Add(button_sizer, 0, wx.LEFT | wx.RIGHT, 15)
vertical_container.AddSpacer(20)
self.SetSizerAndFit(vertical_container)
self.Bind(wx.EVT_BUTTON, self.OnOkButton, self.ok_button)
示例2: build
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def build(self, parent, data, choices=None):
self.parent = parent
self.widget = wx.TextCtrl(self.parent)
self.widget.AppendText('')
self.widget.SetMinSize((0, -1))
dt = FileDrop(self.widget)
self.widget.SetDropTarget(dt)
self.button = wx.Button(self.parent, label=self.button_text, size=(73, 23))
widget_sizer = wx.BoxSizer(wx.HORIZONTAL)
widget_sizer.Add(self.widget, 1, wx.EXPAND)
widget_sizer.AddSpacer(10)
widget_sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
parent.Bind(wx.EVT_BUTTON, self.on_button, self.button)
return widget_sizer
示例3: createStockButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def createStockButton(parent, label):
# wxMSW does not really have them: it does not have any icons and it
# inconsistently adds the shortcut key to some buttons, but not to
# all, so it's better not to use them at all on Windows.
if misc.isUnix:
ids = {
"OK" : wx.ID_OK,
"Cancel" : wx.ID_CANCEL,
"Apply" : wx.ID_APPLY,
"Add" : wx.ID_ADD,
"Delete" : wx.ID_DELETE,
"Preview" : wx.ID_PREVIEW
}
return wx.Button(parent, ids[label])
else:
return wx.Button(parent, -1, label)
# wxWidgets has a bug in 2.6 on wxGTK2 where double clicking on a button
# does not send two wx.EVT_BUTTON events, only one. since the wxWidgets
# maintainers do not seem interested in fixing this
# (http://sourceforge.net/tracker/index.php?func=detail&aid=1449838&group_id=9863&atid=109863),
# we work around it ourselves by binding the left mouse button double
# click event to the same callback function on the buggy platforms.
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent, ctrl):
wx.Dialog.__init__(self, parent, -1, "Character map")
self.ctrl = ctrl
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.charMap = MyCharMap(self)
hsizer.Add(self.charMap)
self.insertButton = wx.Button(self, -1, " Insert character ")
hsizer.Add(self.insertButton, 0, wx.ALL, 10)
wx.EVT_BUTTON(self, self.insertButton.GetId(), self.OnInsert)
gutil.btnDblClick(self.insertButton, self.OnInsert)
util.finishWindow(self, hsizer, 0)
示例5: createControls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def createControls(self):
self.flagOptionsLabel = wx.StaticText(self, label="Flagging methods:")
self.flagOutlierButton = wx.Button(self,-1,"Flag Outlier",size=(160,30))
self.flagRangeButton = wx.Button(self,-1,"Flag Range",size=(160,30))
self.flagMinButton = wx.Button(self,-1,"Flag Minimum",size=(160,30))
self.flagMaxButton = wx.Button(self,-1,"Flag Maximum",size=(160,30))
self.xCheckBox = wx.CheckBox(self,label="X ")
self.yCheckBox = wx.CheckBox(self,label="Y ")
self.zCheckBox = wx.CheckBox(self,label="Z ")
self.fCheckBox = wx.CheckBox(self,label="F ")
self.FlagIDText = wx.StaticText(self,label="Select Min/Max Flag ID:")
self.FlagIDComboBox = wx.ComboBox(self, choices=self.flagidlist,
style=wx.CB_DROPDOWN, value=self.flagidlist[3],size=(160,-1))
self.flagSelectionButton = wx.Button(self,-1,"Flag Selection",size=(160,30))
self.flagDropButton = wx.Button(self,-1,"Drop flagged",size=(160,30))
self.flagLoadButton = wx.Button(self,-1,"Load flags",size=(160,30))
self.flagSaveButton = wx.Button(self,-1,"Save flags",size=(160,30))
self.flagClearButton = wx.Button(self,-1,"Clear flags",size=(160,30))
示例6: createControls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def createControls(self):
self.DrawAuxButton = wx.Button(self,-1,"Draw/Recalc")
self.SaveAuxButton = wx.Button(self,-1,"Save data")
self.AppendAuxButton = wx.Button(self,-1,"Append")
self.OpenAuxButton = wx.Button(self,-1,"Open Aux file")
self.AuxDataLabel = wx.StaticText(self, label="Auxiliary data")
self.AuxDataTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE) # get this value from obsini
self.AuxDataTextCtrl.Disable()
self.AuxResolutionLabel = wx.StaticText(self, label="Time resolution")
self.AuxResolutionTextCtrl = wx.TextCtrl(self, value="NaN")
self.AuxResolutionTextCtrl.Disable()
self.AuxStartDateTextCtrl = wx.TextCtrl(self, value="--")
self.AuxStartDateTextCtrl.Disable()
self.AuxEndDateTextCtrl = wx.TextCtrl(self, value="--")
self.AuxEndDateTextCtrl.Disable()
self.funcLabel = wx.StaticText(self, label="Apply fuctions:")
self.removeOutliersCheckBox = wx.CheckBox(self,
label="Remove Outliers")
self.recoveryCheckBox = wx.CheckBox(self,
label="Show data coverage")
self.interpolateCheckBox = wx.CheckBox(self,
label="Interpolate data")
self.fitCheckBox = wx.CheckBox(self,
label="Fit function")
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent=None, id=wx.ID_ANY):
super().__init__(parent, id)
sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of an edit field in connect dialog to enter name or address of the remote computer.
sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Host:")))
self.host = wx.TextCtrl(self, wx.ID_ANY)
sizer.Add(self.host)
# Translators: Label of the edit field to enter key (password) to secure the remote connection.
sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:")))
self.key = wx.TextCtrl(self, wx.ID_ANY)
sizer.Add(self.key)
# Translators: The button used to generate a random key/password.
self.generate_key = wx.Button(parent=self, label=_("&Generate Key"))
self.generate_key.Bind(wx.EVT_BUTTON, self.on_generate_key)
sizer.Add(self.generate_key)
self.SetSizerAndFit(sizer)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent):
wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ",
style=wx.BU_EXACTFIT)
self._toolbar = parent
self._menu =wx.Menu()
self._axisId = []
# First two menu items never change...
self._allId =wx.NewId()
self._invertId =wx.NewId()
self._menu.Append(self._allId, "All", "Select all axes", False)
self._menu.Append(self._invertId, "Invert", "Invert axes selected", False)
self._menu.AppendSeparator()
bind(self, wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON)
bind(self, wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
bind(self, wx.EVT_MENU, self._handleInvertAxesSelected, id=self._invertId)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent):
wx.Button.__init__(self, parent, wx.ID_ANY, "Axes: ",
style=wx.BU_EXACTFIT)
self._toolbar = parent
self._menu = wx.Menu()
self._axisId = []
# First two menu items never change...
self._allId = wx.NewId()
self._invertId = wx.NewId()
self._menu.Append(self._allId, "All", "Select all axes", False)
self._menu.Append(self._invertId, "Invert", "Invert axes selected",
False)
self._menu.AppendSeparator()
self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=self.GetId())
self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected,
id=self._invertId)
示例10: tkinterApp
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def tkinterApp():
import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title("Python GUI")
aLabel = ttk.Label(win, text="A Label")
aLabel.grid(column=0, row=0)
ttk.Label(win, text="Enter a name:").grid(column=0, row=0)
name = tk.StringVar()
nameEntered = ttk.Entry(win, width=12, textvariable=name)
nameEntered.grid(column=0, row=1)
nameEntered.focus()
def buttonCallback():
action.configure(text='Hello ' + name.get())
action = ttk.Button(win, text="Print", command=buttonCallback)
action.grid(column=2, row=1)
win.mainloop()
#==================================================================
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:22,代码来源:Embed_tkinter.py
示例11: addFileWidgets
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def addFileWidgets(self):
boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
boxSizerH.Add(wx.Button(self.panel, label='Browse to File...'))
boxSizerH.Add(wx.TextCtrl( self.panel, size=(174, -1), value= "Z:\\" ))
boxSizerH1 = wx.BoxSizer(wx.HORIZONTAL)
boxSizerH1.Add(wx.Button(self.panel, label='Copy File To: '))
boxSizerH1.Add(wx.TextCtrl( self.panel, size=(174, -1), value= "Z:\\Backup" ))
boxSizerV = wx.BoxSizer(wx.VERTICAL)
boxSizerV.Add(boxSizerH)
boxSizerV.Add(boxSizerH1)
self.statBoxSizerMgrV.Add( boxSizerV, 1, wx.ALL )
#====================================================================
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:18,代码来源:GUI_wxPython.py
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent)
imageFile = 'Tile.bmp'
self.bmp = wx.Bitmap(imageFile)
# react to a resize event and redraw image
parent.Bind(wx.EVT_SIZE, self.canvasCallback)
menu = wx.Menu()
menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
menu.AppendSeparator()
menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
menuBar = wx.MenuBar()
menuBar.Append(menu, "File")
parent.SetMenuBar(menuBar)
self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)
button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)
parent.CreateStatusBar()
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:24,代码来源:wxPython_Wallpaper.py
示例13: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent)
menu = wx.Menu()
menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
menu.AppendSeparator()
menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
menuBar = wx.MenuBar()
menuBar.Append(menu, "File")
parent.SetMenuBar(menuBar)
self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)
button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)
parent.CreateStatusBar()
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:19,代码来源:wxPython_OpenGL_GUI.py
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, parent):
wx.Button.__init__(self, parent, _NTB_AXISMENU_BUTTON, "Axes: ",
style=wx.BU_EXACTFIT)
self._toolbar = parent
self._menu = wx.Menu()
self._axisId = []
# First two menu items never change...
self._allId = wx.NewId()
self._invertId = wx.NewId()
self._menu.Append(self._allId, "All", "Select all axes", False)
self._menu.Append(self._invertId, "Invert", "Invert axes selected",
False)
self._menu.AppendSeparator()
self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=_NTB_AXISMENU_BUTTON)
self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected,
id=self._invertId)
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Button [as 别名]
def __init__(self, *args, **kwargs):
wx.Panel.__init__(self, *args, **kwargs)
# This is used to determine if a file dialog is open or not.
self.prev_file_path = ''
# Textbox for input file
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '')
self.text_ctrl.Bind(wx.EVT_TEXT, self.on_text_input)
self.button = wx.Button(self, wx.ID_ANY, _('Browse'))
self.button.Bind(wx.EVT_BUTTON, self.on_button_click)
# Drag and drop
drop_target = FileDropTarget(self)
self.text_ctrl.SetDropTarget(drop_target)
top_sizer = wx.BoxSizer(wx.HORIZONTAL)
top_sizer.Add(self.text_ctrl, proportion=1)
top_sizer.Add(self.button)
self.SetSizer(top_sizer)