def InitUI(self):
#draw the pannel
wx.StaticText(self, label='Select elements to download to local storage', pos=(30, 5))
self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,30))
self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,55))
self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,80))
self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,105))
self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,130))
#right side
self.cb_all = wx.CheckBox(self, label='Back up\nWhole Pigrow Folder',pos = (270,75))
#progress bar
wx.StaticText(self, label='saving to; '+ localfiles_info_pnl.local_path, pos=(15, 155))
self.current_file_txt = wx.StaticText(self, label='--', pos=(30, 190))
self.current_dest_txt = wx.StaticText(self, label='--', pos=(30, 215))
#buttons
self.start_download_btn = wx.Button(self, label='Download files', pos=(40, 240), size=(175, 50))
self.start_download_btn.Bind(wx.EVT_BUTTON, self.start_download_click)
self.close_btn = wx.Button(self, label='Close', pos=(415, 240), size=(175, 50))
self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose)
## universal controls
pnl = wx.Panel(self)
python类Button()的实例源码
Embed_tkinter.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 15
收藏 0
点赞 0
评论 0
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()
#==================================================================
GUI_wxPython.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 15
收藏 0
点赞 0
评论 0
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 )
#====================================================================
wxPython_OpenGL_GUI.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 21
收藏 0
点赞 0
评论 0
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()
import_OpenGL_cube_and_cone.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 17
收藏 0
点赞 0
评论 0
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
box = wx.BoxSizer(wx.VERTICAL)
box.Add((20, 30))
keys = buttonDefs.keys()
for k in keys:
text = buttonDefs[k][1]
btn = wx.Button(self, k, text)
box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15)
self.Bind(wx.EVT_BUTTON, self.OnButton, btn)
# put a GLCanvas on the wx.Panel
c = CubeCanvas(self)
c.SetMinSize((200, 200))
box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)
c = ConeCanvas(self)
c.SetMinSize((200, 200))
box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)
self.SetAutoLayout(True)
self.SetSizer(box)
def createWidgets(self):
# Main window resizer object
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(topPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
sizer.Add(bottomPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
#buttons = wx.BoxSizer(wx.HORIZONTAL)
#buttons.Add(wx.Button(self, ID_BUTTON_CHANGE_PIN, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
#buttons.Add(wx.Button(self, wxID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
#sizer.Add(buttons, 1, wx.ALL)
self.SetSizer(sizer)
self.SetAutoLayout(1)
sizer.Fit(self)
self.Layout()
wx.EVT_CLOSE(self, self.closeWindow)
def __init__(self, parent,nbresult,lf,rt):
wx.Panel.__init__(self, parent, -1)
panel = wx.Panel(self, -1)
self.nbResult = nbresult
self.lf = lf
self.rt = rt
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
self.UrlTxtCtrl = wx.TextCtrl(self, -1, "http://news.china.com.cn", style = wx.TE_PROCESS_ENTER)
btnStart = wx.Button(self, -1, "?", (20,20))
#¼
#Onstart = frame.OnStart
self.Bind(wx.EVT_BUTTON, self.OnStart, btnStart)
hbox1.Add(self.UrlTxtCtrl, 1, wx.EXPAND)
hbox1.Add(btnStart,0, wx.EXPAND)
self.SetSizer(hbox1)
def __init__(self, parent,start):
wx.Panel.__init__(self, parent, -1)
self.start = start
panel = wx.Panel(self, -1)
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
self.NumTxtCtrl = wx.TextCtrl(self, -1, " ?v0.1.4", style = wx.TE_PROCESS_ENTER|wx.TE_READONLY)
self.severule = wx.Button(self, -1, "" ,(20,20))
self.btnClear = wx.Button(self, -1, "?" ,(20,20))
self.btnParseURL = wx.Button(self, -1, "URL" ,(20,20))
self.btnParseContent = wx.Button(self, -1, "?" ,(20,20))
#sizer
hbox2.Add(self.NumTxtCtrl,1, wx.EXPAND)
hbox2.Add(self.severule,0, wx.EXPAND)
hbox2.Add(self.btnClear,0, wx.EXPAND)
hbox2.Add(self.btnParseURL,0, wx.EXPAND)
hbox2.Add(self.btnParseContent,0, wx.EXPAND)
self.SetSizer(hbox2)
##?¼
self.Bind(wx.EVT_BUTTON, self.start.OnRemoveCache, self.btnClear)
self.Bind(wx.EVT_BUTTON, self.start.OnSeveResult, self.severule)
self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseURL)
self.Bind(wx.EVT_BUTTON, self.start.OnStart, self.btnParseContent)
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'):
wx.Dialog.__init__(self, parent, id, title, pos, size, style, name)
label = wx.StaticText(self, label=message)
button = wx.Button(self, id=wx.ID_OK, label="Close")
button.SetDefault()
line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url)
sizer = wx.BoxSizer(wx.VERTICAL)
button_sizer = wx.StdDialogButtonSizer()
button_sizer.AddButton(button)
button_sizer.Realize()
sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5)
sizer.Add(download_ctrl, 0, wx.ALL, 10)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
self.SetSizer(sizer)
sizer.Fit(self)
def initMediaPath(self):
mediaPathControlBox = widgets.ControlBox(self, label='Media Path', orient=wx.HORIZONTAL)
self.mediaPathTextCtrl = wx.TextCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
self.mediaPathTextCtrl.SetValue(self.pg.defaultMusicDir)
mediaPathControlBox.Add(self.mediaPathTextCtrl, proportion=1,
flag=wx.ALL | wx.EXPAND, border=10)
self.Bind(wx.EVT_TEXT_ENTER, self.setMediaPath, self.mediaPathTextCtrl)
self.offlineControls += [self.mediaPathTextCtrl]
self.mediaBrowseButton = wx.Button(self, label='Browse')
mediaPathControlBox.Add(self.mediaBrowseButton, proportion=0,
flag=wx.TOP | wx.RIGHT | wx.BOTTOM, border=10)
self.Bind(wx.EVT_BUTTON, self.mediaBrowse, self.mediaBrowseButton)
self.offlineControls += [self.mediaBrowseButton]
self.sizer.Add(mediaPathControlBox, proportion=0,
flag=wx.ALL | wx.EXPAND, border=10)
def initStandardToolbarControls(self):
# button to start and stop the page
self.runButton = wx.Button(self.toolbar, label='Start')
self.toolbar.AddControl(self.runButton, label='Run')
self.Bind(wx.EVT_BUTTON, self.toggleRunning, self.runButton)
# toolbar button to pause without stopping data acquisition
self.pauseButton = wx.Button(self.toolbar, label='Pause')
self.pauseButton.Disable()
self.toolbar.AddControl(self.pauseButton, label='Pause')
self.Bind(wx.EVT_BUTTON, self.togglePause, self.pauseButton)
# toolbar button to start and stop EEG recording
self.recordButton = wx.Button(self.toolbar, label='Start Recording')
self.recordButton.Disable()
self.toolbar.AddControl(self.recordButton, label='Record EEG')
self.Bind(wx.EVT_BUTTON, self.toggleRecord, self.recordButton)
# toolbar button to save an image of the current plot
self.captureButton = wx.Button(self.toolbar, label='Capture Image')
self.toolbar.AddControl(self.captureButton, label='Capture Image')
self.Bind(wx.EVT_BUTTON, self.captureImage, self.captureButton)
# init toolbar controls in base class
StandardPage.initStandardToolbarControls(self)
def initStandardToolbarControls(self):
# button to start training process
self.trainButton = wx.Button(self.toolbar, label='Train')
self.toolbar.AddControl(self.trainButton, label='Train')
self.Bind(wx.EVT_BUTTON, self.toggleTrain, self.trainButton)
# button to re-train classifier
self.retrainButton = wx.Button(self.toolbar, label='Retrain')
self.retrainButton.Disable()
self.toolbar.AddControl(self.retrainButton, label='Retrain')
self.Bind(wx.EVT_BUTTON, self.retrain, self.retrainButton)
# button to start and stop the interface
self.testButton = wx.Button(self.toolbar, label='Test')
self.testButton.Disable()
self.toolbar.AddControl(self.testButton, label='Test')
self.Bind(wx.EVT_BUTTON, self.toggleTest, self.testButton)
# init toolbar controls in base class
StandardPage.initStandardToolbarControls(self)
def __init__(self, *args, **kwds):
# begin wxGlade: Dialog_snapshot.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
wx.Dialog.__init__(self, *args, **kwds)
self.label_1 = wx.StaticText(self, wx.ID_ANY, "Nombre:")
self.nombre_snap = wx.TextCtrl(self, wx.ID_ANY, "")
self.label_2 = wx.StaticText(self, wx.ID_ANY, u"Descripci\u00f3n:")
self.descripcion_snap = wx.TextCtrl(self, wx.ID_ANY, "")
self.checkbox_memory = wx.CheckBox(self, wx.ID_ANY, "memory")
self.checkbox_quiesce = wx.CheckBox(self, wx.ID_ANY, "quiesce")
self.snap_ok = wx.Button(self, wx.ID_OK, "OK")
self.snap_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
self.__set_properties()
self.__do_layout()
# end wxGlade
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs")
note2 = wx.StaticText(self, -1, "a separate frame")
b = wx.Button(self, -1, "Open Demo Frame Now")
b.Bind(wx.EVT_BUTTON, self.OnButton)
S = wx.BoxSizer(wx.VERTICAL)
S.Add((10, 10), 1)
S.Add(note1, 0, wx.ALIGN_CENTER)
S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5)
S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5)
S.Add((10, 10), 1)
self.SetSizer(S)
self.Layout()
def __init__(self, *args, **kwds):
# begin wxGlade: LogicalVolumeDialog.__init__
wx.Dialog.__init__(self, *args, **kwds)
self.panel_1 = wx.Panel(self, wx.ID_ANY)
self.panel_4 = wx.Panel(self, wx.ID_ANY)
self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL)
self.panel_7 = wx.Panel(self, wx.ID_ANY)
self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.panel_8 = wx.Panel(self, wx.ID_ANY)
self.panel_3 = wx.Panel(self, wx.ID_ANY)
self.panel_5 = wx.Panel(self, wx.ID_ANY)
self.button_select = wx.Button(self, wx.ID_OK, _("Select"))
self.panel_9 = wx.Panel(self, wx.ID_ANY)
self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
self.panel_6 = wx.Panel(self, wx.ID_ANY)
self.panel_2 = wx.Panel(self, wx.ID_ANY)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL)
# end wxGlade
self.PopulateVolumes()
def __init__( self, parent ):
win_height = parent.GetSize()[1]
height_of_pannels_above = 230
space_left = win_height - height_of_pannels_above
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL )
# Start drawing the UI elements
wx.StaticText(self, label='Pigrow Config', pos=(25, 10))
self.update_config_btn = wx.Button(self, label='read config from pigrow', pos=(15, 60), size=(175, 30))
self.update_config_btn.Bind(wx.EVT_BUTTON, self.update_config_click)
self.name_box_btn = wx.Button(self, label='change box name', pos=(15, 95), size=(175, 30))
self.name_box_btn.Bind(wx.EVT_BUTTON, self.name_box_click)
self.config_lamp_btn = wx.Button(self, label='config lamp', pos=(15, 130), size=(175, 30))
self.config_lamp_btn.Bind(wx.EVT_BUTTON, self.config_lamp_click)
self.config_dht_btn = wx.Button(self, label='config dht', pos=(15, 165), size=(175, 30))
self.config_dht_btn.Bind(wx.EVT_BUTTON, self.config_dht_click)
self.new_gpio_btn = wx.Button(self, label='Add new relay device', pos=(15, 200), size=(175, 30))
self.new_gpio_btn.Bind(wx.EVT_BUTTON, self.add_new_device_relay)
self.update_settings_btn = wx.Button(self, label='update pigrow settings', pos=(15, 235), size=(175, 30))
self.update_settings_btn.Bind(wx.EVT_BUTTON, self.update_setting_click)
def __init__( self, parent ):
win_height = parent.GetSize()[1]
height_of_pannels_above = 230
space_left = win_height - height_of_pannels_above
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL )
wx.StaticText(self, label='Cron Config Menu', pos=(25, 10))
self.read_cron_btn = wx.Button(self, label='Read Crontab', pos=(10, 40), size=(175, 30))
self.read_cron_btn.Bind(wx.EVT_BUTTON, self.read_cron_click)
self.new_cron_btn = wx.Button(self, label='New cron job', pos=(10, 80), size=(175, 30))
self.new_cron_btn.Bind(wx.EVT_BUTTON, self.new_cron_click)
self.update_cron_btn = wx.Button(self, label='Update Cron', pos=(10, 120), size=(175, 30))
self.update_cron_btn.Bind(wx.EVT_BUTTON, self.update_cron_click)
self.SetBackgroundColour('sea green') #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS
bSizer = wx.BoxSizer(wx.VERTICAL)
bSizer.Add(self.read_cron_btn, 0, wx.ALL, 5)
bSizer.Add(self.new_cron_btn, 0, wx.ALL, 5)
bSizer.Add(self.update_cron_btn, 0, wx.ALL, 5)
self.SetSizer(bSizer)
def InitUI(self):
#draw the pannel
wx.StaticText(self, label='Select elements to upload from local storage to pi\n\n ** Warning this will overwrite current pigrow files \n which may result in loss of data **', pos=(30, 5))
self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,90))
self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,115))
self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,140))
self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,165))
self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,190))
#right side
self.cb_all = wx.CheckBox(self, label='Restore Back up\nof whole Pigrow Folder',pos = (270,130))
#progress bar
wx.StaticText(self, label='uploading from; '+ localfiles_info_pnl.local_path, pos=(15, 215))
self.current_file_txt = wx.StaticText(self, label='--', pos=(30, 245))
self.current_dest_txt = wx.StaticText(self, label='--', pos=(30, 270))
#buttons
self.start_upload_btn = wx.Button(self, label='Upload files', pos=(40, 300), size=(175, 50))
self.start_upload_btn.Bind(wx.EVT_BUTTON, self.start_upload_click)
self.close_btn = wx.Button(self, label='Close', pos=(415, 300), size=(175, 50))
self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose)
## universal controls
pnl = wx.Panel(self)
def __init__( self, parent ):
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0,0), size = wx.Size( 285,190 ), style = wx.TAB_TRAVERSAL )
self.SetBackgroundColour((150,230,170)) #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS
pi_link_pnl.target_ip = ''
pi_link_pnl.target_user = ''
pi_link_pnl.target_pass = ''
pi_link_pnl.config_location_on_pi = '/home/pi/Pigrow/config/pigrow_config.txt'
## the three boxes for pi's connection details, IP, Username and Password
self.l_ip = wx.StaticText(self, label='address', pos=(10, 20))
self.tb_ip = wx.TextCtrl(self, pos=(125, 25), size=(150, 25))
self.tb_ip.SetValue("192.168.1.")
self.l_user = wx.StaticText(self, label='Username', pos=(10, 60))
self.tb_user = wx.TextCtrl(self, pos=(125, 60), size=(150, 25))
self.tb_user.SetValue("pi")
self.l_pass = wx.StaticText(self, label='Password', pos=(10, 95))
self.tb_pass = wx.TextCtrl(self, pos=(125, 95), size=(150, 25))
self.tb_pass.SetValue("raspberry")
## link with pi button
self.link_with_pi_btn = wx.Button(self, label='Link to Pi', pos=(10, 125), size=(175, 30))
self.link_with_pi_btn.Bind(wx.EVT_BUTTON, self.link_with_pi_btn_click)
self.link_status_text = wx.StaticText(self, label='-- no link --', pos=(25, 160))
## seek next pi button
self.seek_for_pigrows_btn = wx.Button(self, label='Seek next', pos=(190,125))
self.seek_for_pigrows_btn.Bind(wx.EVT_BUTTON, self.seek_for_pigrows_click)
def on_c2_info(self, e):
self.menu_c2_info.Enable(False)
self.grid.ClearGrid()
self.grid_set_shape(2, 2, 100)
self.grid.SetColSize(1, 200)
self.grid.SetCellValue(0, 0, "Event Name")
self.grid.SetCellValue(1, 0, "Org Login")
self.grid_column_readonly(0)
if not self.read_c2_info():
self.c2_info = ["", ""]
self.grid.SetCellValue(0, 1, self.c2_info[0])
self.grid.SetCellValue(1, 1, self.c2_info[1])
apply_button = wx.Button(self, wx.ID_APPLY)
self.Bind(wx.EVT_BUTTON, self.on_c2_info_apply, apply_button)
self.actions_panel.Add(apply_button, 1)
self.Layout()
def __init__(self, parent, info):
wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400),
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
if parent and parent.GetIcon():
self.SetIcon(parent.GetIcon())
self.SetMinSize((400, 300))
close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close"))
ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
ctrl.SetValue(info.License)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.Add(close)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10)
sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
self.SetSizer(sizer)
self.Layout()
self.Show()
self.SetEscapeId(close.GetId())
close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
def __init__(self, parent):
wx.Control.__init__(self, parent)
main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
main_sizer.AddGrowableCol(0)
main_sizer.AddGrowableRow(0)
# create location text control
self.Location = wx.TextCtrl(self, size=wx.Size(0, -1),
style=wx.TE_PROCESS_ENTER)
self.Location.Bind(wx.EVT_KEY_DOWN, self.OnLocationChar)
main_sizer.AddWindow(self.Location, flag=wx.GROW)
# create browse button
self.BrowseButton = wx.Button(self, label='...', size=wx.Size(30, -1))
self.BrowseButton.Bind(wx.EVT_BUTTON, self.OnBrowseButtonClick)
main_sizer.AddWindow(self.BrowseButton, flag=wx.GROW)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.SetSizer(main_sizer)
self.Controller = None
self.VarType = None
self.Default = False
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY,
"File and Folder Dialogs Tutorial")
panel = wx.Panel(self, wx.ID_ANY)
self.currentDirectory = os.getcwd()
# create the buttons and bindings
dirDlgBtn1 = wx.Button(panel, label="Choose Source")
dirDlgBtn1.Bind(wx.EVT_BUTTON, self.onDir1)
dirDlgBtn2 = wx.Button(panel, label="Choose Destination")
dirDlgBtn2.Bind(wx.EVT_BUTTON, self.onDir2)
moveBtn=wx.Button(panel, label="Check and Move Files")
moveBtn.Bind(wx.EVT_BUTTON, self.moveUFiles)
# put the buttons in a sizer
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(dirDlgBtn1, 0, wx.ALL|wx.CENTER, 5)
sizer.Add(dirDlgBtn2, 0, wx.ALL|wx.CENTER, 5)
sizer.Add(moveBtn, 0, wx.ALL|wx.CENTER, 5)
panel.SetSizer(sizer)
def __init__(self, *args, **kwds):
# begin wxGlade: Add_Student.__init__
kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.STAY_ON_TOP
wx.Dialog.__init__(self, *args, **kwds)
self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
self.text_ctrl_3 = wx.TextCtrl(self, -1, "")
self.button_1 = wx.Button(self, -1, "Add")
self.Bind(wx.EVT_CLOSE,self.OnClose,self)
self.__set_properties()
self.__do_layout()
self.DB=db_operations()
self.success=False
self.STUDENT_INFO=[]
# end wxGlade
def __init__(self, parent):
# begin wxGlade: CE_TE.__init__
#kwds["style"] = wx.CLOSE_BOX|wx.MINIMIZE_BOX
wx.Dialog.__init__(self, parent,id=-1,title="CE and TE")
self.parent=parent
self.label_1 = wx.StaticText(self, -1, "Max_CE")
self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
self.label_2 = wx.StaticText(self, -1, "Max_TE")
self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
self.button_1 = wx.Button(self, -1, "OK")
self.button_2 = wx.Button(self, -1, "Cancel")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_1)
self.Bind(wx.EVT_TEXT, self.On_CE_Text, self.text_ctrl_1)
self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_2)
self.Bind(wx.EVT_TEXT, self.On_TE_Text, self.text_ctrl_2)
self.Bind(wx.EVT_BUTTON, self.On_Ok, self.button_1)
self.Bind(wx.EVT_BUTTON, self.On_Cancel, self.button_2)
# end wxGlade
def on_button_email_passwd(self,event):# Button save email and password
email=self.text_ctrl_email.Value
passwd=self.text_ctrl_email_passwd.Value
if not self.V.validate_email(email)[0]:
msg="Invalid Email"
dlg = wx.MessageDialog(self, msg, 'Error',wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
return 0
self.DB.Set_SMS_Sender_Mail(email)
self.DB.Set_SMS_Sender_Mail_Password(passwd)
msg="Successfully Saved"
dlg = wx.MessageDialog(self, msg, 'Success',wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
def __init__(self, *args, **kwds):
# begin wxGlade: disclaimer_win.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.label_1 = wx.StaticText(self, wx.ID_ANY, ("Disclaimer"))
self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP)
self.button_disagree = wx.Button(self, wx.ID_ANY, ("Disagree"))
self.button_agree = wx.Button(self, wx.ID_ANY, ("I agree"))
self.text='''
This SOFTWARE PRODUCT is a an open source free software distributed with GPL 3 License. Your are free to modify it subject to the
conditions laid in the license. It is also stated that the software is provided "as is" and "with all faults."
THE developer makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT.
There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and and suits your needs.
You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.'''
self.__set_properties()
self.__do_layout()
self.agree=False
self.Bind(wx.EVT_BUTTON, self.on_disagree, self.button_disagree)
self.Bind(wx.EVT_BUTTON, self.on_agree, self.button_agree)
# end wxGlade
def __init__(self, *args, **kwds):
# begin wxGlade: secret_win.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.label_1 = wx.StaticText(self, -1, "School Name")
self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
self.label_2 = wx.StaticText(self, -1, "School Code")
self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
self.button_1 = wx.Button(self, -1, "Save")
self.DB=db_operations()
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.on_save, self.button_1)
self.on_load()
self.Center()
# end wxGlade
def __init__(self, *args, **kwds):
# begin wxGlade: sms_dialoge.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.THICK_FRAME
wx.Frame.__init__(self, *args, **kwds)
self.panel_5 = wx.Panel(self, wx.ID_ANY)
self.label_7 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Username"))
self.combo_box_1 = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=[("Select"), ("admin"), ("teacher")], style=wx.CB_READONLY|wx.CB_DROPDOWN)
self.label_8 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Password"))
self.text_ctrl_1 = wx.TextCtrl(self.panel_5, wx.ID_ANY, "", style=wx.TE_PASSWORD)
self.button_1 = wx.Button(self.panel_5, wx.ID_ANY, ("Cancel"))
self.button_2 = wx.Button(self.panel_5, wx.ID_ANY, ("Login"))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_COMBOBOX, self.on_user, self.combo_box_1)
self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1)
self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_1)
self.Bind(wx.EVT_BUTTON, self.on_login, self.button_2)
self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress)
self.Bind(wx.EVT_CLOSE,self.on_close,self)
self.UO=user_operations(self)
# end wxGlade
def __init__(self, *args, **kwds):
# begin wxGlade: MyDialog.__init__
#args[
kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP
wx.Dialog.__init__(self, *args, **kwds)
self.text_ctrl_passwd = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD)
self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel"))
self.button_ok = wx.Button(self, wx.ID_ANY, _("OK"))
self.__set_properties()
self.__do_layout()
self.password_text=''
self.Bind(wx.EVT_TEXT, self.on_passwod, self.text_ctrl_passwd)
self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.button_cancel)
self.Bind(wx.EVT_BUTTON, self.on_button_ok, self.button_ok)
self.cancelled=False
# end wxGlade