Python wx 模块,BITMAP_TYPE_ANY 实例源码

我们从Python开源项目中,提取了以下40个代码示例,用于说明如何使用wx.BITMAP_TYPE_ANY

项目:Crypter    作者:sithis993    | 项目源码 | 文件源码
def __init__(self):
        '''
        @summary: Constructor
        @param config_dict: The build configuration, if present
        @param load_config: Handle to a config loader method/object
        '''
        self.language = DEFAULT_LANGUAGE
        self.__builder = None
        self.config_file_path = None

        # Init super - MainFrame
        MainFrame.__init__( self, parent=None )
        self.console = Console(self.ConsoleTextCtrl)
        self.StatusBar.SetStatusText("Ready...")
        self.SetIcon(wx.IconFromBitmap(wx.Bitmap("ExeBuilder\\static\\builder_logo.bmp", wx.BITMAP_TYPE_ANY)))

        # Update GUI Visuals
        self.update_gui_visuals()

        # Set initial event handlers
        self.set_events()
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def graph_caps(self, cap_files, graphdir):
        OS = "linux"
        if len(cap_files) > 1:
            print("make caps graph")
            if OS == "linux":
                print("Yay linux")
                os.system("../visualisation/caps_graph.py caps="+capsdir+" out="+graphdir)
            elif OS == 'win':
                print("oh, windows, i prefer linux but no worries...")
                os.system("python ../visualisation/caps_graph.py caps="+capsdir+" out="+graphdir)
        else:
            print("skipping graphing caps - disabled or no caps to make graphs with")
        if os.path.exists(graphdir+'caps_filesize_graph.png'):
            cap_size_graph_path = wx.Image(graphdir+'caps_filesize_graph.png', wx.BITMAP_TYPE_ANY)
            return cap_size_graph_path
        else:
            print("NOT ENOUGH CAPS GRAPH SO USING BLANK THUMB")
            blankimg = wx.EmptyImage(width=100, height=100, clear=True)
            return blankimg
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__( self, parent ):
        win_height = parent.GetSize()[1]
        win_width = parent.GetSize()[0]
        w_space_left = win_width - 285
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL )
        ## Draw UI elements
        png = wx.Image('./config_info.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
        #SDcard details
        config_info_pnl.boxname_text = wx.TextCtrl(self,  pos=(25, 150), size=(265,65))
        config_info_pnl.location_text = wx.StaticText(self,  label='locations', pos=(520, 120), size=(200,30))
        config_info_pnl.config_text = wx.StaticText(self,  label='config', pos=(520, 185), size=(200,30))
        config_info_pnl.lamp_text = wx.StaticText(self,  label='lamp', pos=(10, 330), size=(200,30))
        config_info_pnl.dht_text = wx.StaticText(self,  label='dht', pos=(10, 415), size=(200,30))
        config_info_pnl.gpio_table = self.GPIO_list(self, 1)
        config_info_pnl.gpio_table.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_GPIO)
项目:pinder    作者:dhharris    | 项目源码 | 文件源码
def view(self, file):
        '''
        Called when loading a new image. Pass arg bytesIO image file
        '''
        img = wx.Image(file, wx.BITMAP_TYPE_ANY)
        # scale the image, preserving the aspect ratio
        W = img.GetWidth()
        H = img.GetHeight()
        if W > H:
            NewW = self.PhotoMaxSize
            NewH = self.PhotoMaxSize * H / W
        else:
            NewH = self.PhotoMaxSize
            NewW = self.PhotoMaxSize * W / H
        img = img.Scale(NewW, NewH)

        self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
        self.panel.Refresh()
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def __init__(self, parent=None, fdir='./', title='pyDataViewer', 
                 size=(800,600), **kwargs):

        wx.Frame.__init__(self,parent,title=title,size=size)
        try:
            _icon = wx.EmptyIcon()
            _icon.CopyFromBitmap(
                # postproclib.visualiser.__path__ (pplvpath) is a list
                wx.Bitmap(pplvpath[0]+"/logo.gif", wx.BITMAP_TYPE_ANY)
            )
            self.SetIcon(_icon)
        except IOError:
            print('Couldn\'t load icon')

        self.dirchooser = DirectoryChooserPanel(self, fdir)

        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.dirchooser, 0, wx.EXPAND, 0)
        self.SetSizer(self.vbox)

        self.visualiserpanel = None
        self.new_visualiserpanel(fdir)
        self.fdir = fdir

        self.set_bindings()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __set_properties(self):
        # begin wxGlade: Login.__set_properties
        self.SetTitle("Login")
        #_icon = wx.EmptyIcon()
        #_icon.CopyFromBitmap(wx.Bitmap("/media/f67bc164-f440-4c0f-9e9b-3ad70ff1adc2/home/asif/Desktop/waiter animation/2.gif", wx.BITMAP_TYPE_ANY))
        #self.SetIcon(_icon)
        self.SetSize((462, 239))
        self.SetFocus()
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_1.SetSelection(0)
        self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_1.SetMinSize((185, 30))
        self.button_1.SetMinSize((85, 35))
        self.button_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Ubuntu"))
        self.button_2.SetMinSize((85, 35))
        self.button_2.Disable()
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_delete(self, event):  # wxGlade: student_profie.<event_handler>
        self.button_delete.Disable()
        self.button_save.Disable()
        self.db_delete()
        self.clear_student_details()
        self.bitmap_photo.Enable(False)
        cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
        path=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"
        if os.path.isfile(path):
            path=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"

            os.remove(path)
            path=cur_dir+"/Resources/img/browse.jpg"
            self.bitmap_photo = wx.BitmapButton(self.panel_1, wx.ID_ANY,wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
            self.__set_properties()
            self.__do_layout()



        event.Skip()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def onView(self):
        """
        Attempts to load the image and display it
        """
        filepath = self.photoTxt.GetValue()
        img = wx.Image(filepath, wx.BITMAP_TYPE_ANY)
        # scale the image, preserving the aspect ratio
        W = img.GetWidth()
        H = img.GetHeight()
        if W > H:
            NewW = self.PhotoMaxSize
            NewH = self.PhotoMaxSize * H / W
        else:
            NewH = self.PhotoMaxSize
            NewW = self.PhotoMaxSize * W / H
        img = img.Scale(NewW,NewH)

        self.imageCtrl.SetBitmap(wx.Bitmap(img))
        self.panel.Refresh()
        self.mainSizer.Fit(self.frame)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def loadImage(self, image):
        """
        Load the image into the application for display
        """
        image_name = os.path.basename(image)
        img = wx.Image(image, wx.BITMAP_TYPE_ANY)
        # scale the image, preserving the aspect ratio
        W = img.GetWidth()
        H = img.GetHeight()
        if W > H:
            NewW = self.photoMaxSize
            NewH = self.photoMaxSize * H / W
        else:
            NewH = self.photoMaxSize
            NewW = self.photoMaxSize * W / H
        img = img.Scale(NewW,NewH)

        self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
        self.imageLabel.SetLabel(image_name)
        self.Refresh()
        Publisher().sendMessage("resize", "")
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def MakeThumbnail(self, filepath, PhotoMaxSize):
        img = wx.Image(filepath, wx.BITMAP_TYPE_ANY)
        # scale image, preserve aspect ratio
        W = img.GetWidth()
        H = img.GetHeight()
        if W > H:
            NewW = PhotoMaxSize
            NewH = PhotoMaxSize * H / W
        else:
            NewH = PhotoMaxSize
            NewW = PhotoMaxSize * W / H
        img = img.Scale(NewW,NewH)
        imgb = wx.BitmapFromImage(img)
        return img
项目:FestEngine    作者:Himura2la    | 项目源码 | 文件源码
def load_zad(self, file_path, fit=True):
        img = wx.Image(file_path, wx.BITMAP_TYPE_ANY)
        if fit:
            w, h = img.GetWidth(), img.GetHeight()
            max_w, max_h = self.images_panel.GetSize()
            target_ratio = min(max_w / float(w), max_h / float(h))
            new_w, new_h = [int(x * target_ratio) for x in (w, h)]
            img = img.Scale(new_w, new_h, wx.IMAGE_QUALITY_HIGH)
        self.images_panel.drawable_bitmap = wx.Bitmap(img)
        self.images_panel.Refresh()
项目:fritzchecksum    作者:mementum    | 项目源码 | 文件源码
def CreateBitmap(self, artid, client, size):
        if not artid.startswith('priv'):
            return wx.NullBitmap

        artid = artid.split('/')[1:]  # Split path and remove 'priv'
        artid = '/'.join(artid)  # rejoin remaining parts

        fpath = appconstants.getdatapath(artid)
        return wx.Bitmap(fpath, wx.BITMAP_TYPE_ANY)
项目:MaTags    作者:hastelloy    | 项目源码 | 文件源码
def __init__(self, parent, title):
        style = wx.DEFAULT_FRAME_STYLE & ~(
            wx.RESIZE_BORDER | wx.MAXIMIZE_BOX |
            wx.MINIMIZE_BOX|wx.CLOSE_BOX)

        wx.Frame.__init__(self, parent, title=title, 
            style=style, size=(400,60))
        self.textbox = wx.TextCtrl(self)

        img = wx.Image("matags.png", wx.BITMAP_TYPE_ANY)
        bmp = wx.Bitmap(img)
        self.icon = wx.Icon()
        self.icon.CopyFromBitmap(bmp)
        self.SetIcon(self.icon)

        self.tbIcon = wx.adv.TaskBarIcon()
        self.tbIcon.SetIcon(self.icon)

        self.Show(True)
        self.Centre()

        self.reg_hot_keys()        
        self.Bind(wx.EVT_HOTKEY, self.on_extract_tag, 
            id=self.hotkeys['extract_tag'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_close, 
            id=self.hotkeys['quit'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_activate, 
            id=self.hotkeys['activate'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_refresh, 
            id=self.hotkeys['refresh'][0])
        self.textbox.Bind(wx.EVT_CHAR, self.check_key)
        # do not use EVT_KEY_DOWN, 
        # it becomes difficult to get lower case
        # self.textbox.Bind(wx.EVT_KEY_DOWN, self.check_key)
        # self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(wx.EVT_ICONIZE, self.on_iconify)
        self.matags = MaTags()
        # try:
        # except Exception as e:
        #     self.textbox.ChangeValue(e.args[0].decode('utf8', 'ignore'))
        #     self.textbox.Disable()
项目:pyvmwareclient    作者:wbugbofh    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        wx.Frame.__init__(self, *args, **kwds)
        self.label_5 = wx.StaticText(self, wx.ID_ANY, "Cadena Busqueda:")
        self.text_ctrl_bucar = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_buscar = wx.Button(self, wx.ID_ANY, "Buscar")
        self.label_6 = wx.StaticText(self, wx.ID_ANY, "total VM: 333")
        self.bitmap_button_1 = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap("/home/mario/pyvmwareclient/wxglade/recicla.png", wx.BITMAP_TYPE_ANY))
        self.list_ctrl_1 = wx.ListCtrl(self, wx.ID_ANY)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def updatelastpic(self, lframe):
        capsdir = self.capsfolder_box.GetValue()
        last_pic = str(capsdir + cap_files[lframe])
        if os.path.exists(last_pic):
            last_pic = wx.Image(last_pic, wx.BITMAP_TYPE_ANY)
            last_pic = self.scale_pic(last_pic, 500)
            self.last_pic.SetBitmap(wx.BitmapFromImage(last_pic))
            lpicdate = self.date_from_fn(cap_files[lframe])
            self.lpic_text.SetLabel('Frame ' + str(lframe) + '  -  ' + str(lpicdate))
        else:
            self.last_pic.SetBitmap(wx.EmptyBitmap(10,10))
            self.fpic_text.SetLabel('end')
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def updatefirstpic(self, fframe):
        capsdir = self.capsfolder_box.GetValue()
        first_pic = str(capsdir + cap_files[fframe])
        if os.path.exists(first_pic):
            first_pic = wx.Image(first_pic, wx.BITMAP_TYPE_ANY)
            first_pic = self.scale_pic(first_pic, 500)
            fpicdate = self.date_from_fn(cap_files[fframe])
            self.fpic_text.SetLabel('Frame ' + str(fframe) + '  -  ' + str(fpicdate))
            self.first_pic.SetBitmap(wx.BitmapFromImage(first_pic))
        else:
            self.first_pic.SetBitmap(wx.EmptyBitmap(10,10))
            self.fpic_text.SetLabel('start')
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def capture_cam_image(self, e):
        target_ip = self.tb_ip.GetValue()
        target_user = self.tb_user.GetValue()
        target_pass = self.tb_pass.GetValue()
        cam_capture_choice = self.cam_combo.GetValue()
        s_val = str(self.tb_s.GetValue())
        c_val = str(self.tb_c.GetValue())
        g_val = str(self.tb_g.GetValue())
        b_val = str(self.tb_b.GetValue())
        x_dim = str(self.tb_x.GetValue())
        y_dim = str(self.tb_y.GetValue())
        cam_select = self.cam_select_cb.GetValue()
        if cam_capture_choice == 'fswebcam':
            ctrl_text_string = self.setting_string_tb.GetValue()
            ctrl_test_value = self.setting_value_tb.GetValue()
            cmd_str = self.cmds_string_tb.GetValue()
            if not ctrl_test_value == '':
                found_login, cam_output, output_file = take_test_image(target_ip, target_user, target_pass,
                                                                       s_val, c_val, g_val, b_val,
                                                                       x_dim, y_dim, cam_select,
                                                                       cam_capture_choice,
                                                                       ctrl_test_value=ctrl_test_value, ctrl_text_string=ctrl_text_string, cmd_str=cmd_str)
            else:
                found_login, cam_output, output_file = take_test_image(target_ip, target_user, target_pass,
                                                                       s_val, c_val, g_val, b_val,
                                                                       x_dim, y_dim, cam_select,
                                                                       cam_capture_choice, cmd_str=cmd_str)
        else:
            found_login, cam_output, output_file = take_test_image(target_ip, target_user, target_pass,
                                                                   s_val, c_val, g_val, b_val,
                                                                   x_dim, y_dim, cam_select,
                                                                   cam_capture_choice)
        photo_location = get_test_pic(target_ip, target_user, target_pass, output_file)
        self.main_image.SetBitmap(wx.BitmapFromImage(wx.Image(photo_location, wx.BITMAP_TYPE_ANY)))
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def capture_unset_cam_image(self, e):
        target_ip = self.tb_ip.GetValue()
        target_user = self.tb_user.GetValue()
        target_pass = self.tb_pass.GetValue()
        x_dim = self.tb_x.GetValue()
        y_dim = self.tb_y.GetValue()
        cam_select = self.cam_select_cb.GetValue()
        extra_args = '' #will be used for camera select
        cam_capture_choice = self.cam_combo.GetValue()
        found_login, cam_output, output_file = take_unset_test_image(target_ip, target_user, target_pass, x_dim, y_dim, cam_select, cam_capture_choice)
        #print cam_output
        photo_location = get_test_pic(target_ip, target_user, target_pass, output_file)
        #print photo_location
        self.main_image.SetBitmap(wx.BitmapFromImage(wx.Image(photo_location, wx.BITMAP_TYPE_ANY)))
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__( self, parent ):
        win_height = parent.GetSize()[1]
        win_width = parent.GetSize()[0]
        w_space_left = win_width - 285
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL )
        ## Draw UI elements
        png = wx.Image('./sysconf.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
        #SDcard details
        system_info_pnl.sys_hdd_total = wx.StaticText(self,  label='total;', pos=(250, 180), size=(200,30))
        system_info_pnl.sys_hdd_remain = wx.StaticText(self,  label='free;', pos=(250, 250), size=(200,30))
        system_info_pnl.sys_hdd_used = wx.StaticText(self,  label='Used;', pos=(250, 215), size=(200,30))
        system_info_pnl.sys_pigrow_folder = wx.StaticText(self,  label='Pigrow folder;', pos=(250, 285), size=(200,30))
        #Software details
        system_info_pnl.sys_os_name = wx.StaticText(self,  label='os installed;', pos=(250, 365), size=(200,30))
        #system_info_pnl.sys_pigrow_version = wx.StaticText(self,  label='pigrow version;', pos=(250, 405), size=(200,30))
        system_info_pnl.sys_pigrow_update = wx.StaticText(self,  label='Pigrow update status', pos=(250, 450), size=(200,30))
        #wifi deatils
        system_info_pnl.sys_network_name = wx.StaticText(self,  label='network name', pos=(250, 535), size=(200,30))
        system_info_pnl.wifi_list = wx.StaticText(self,  label='wifi list', pos=(140, 620), size=(200,30))

        #camera details
        system_info_pnl.sys_camera_info = wx.StaticText(self,  label='camera info', pos=(585, 170), size=(200,30))
        #power level warning details
        system_info_pnl.sys_power_status = wx.StaticText(self,  label='power status', pos=(625, 390), size=(200,30))
        # Raspberry Pi revision
        system_info_pnl.sys_pi_revision = wx.StaticText(self,  label='raspberry pi version', pos=(625, 450), size=(200,30))
        # Pi datetime vs local pc datetime
        system_info_pnl.sys_pi_date = wx.StaticText(self,  label='datetime on pi', pos=(625, 495), size=(500,30))
        system_info_pnl.sys_pc_date = wx.StaticText(self,  label='datetime on local pc', pos=(625, 525), size=(200,30))
        #system_info_pnl.sys_time_diff = wx.StaticText(self,  label='difference', pos=(700, 555), size=(200,30))

#
#
#
### pigrow Config pannel
#
#
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def InitUI(self):
        # these need to be set by whoever calls the dialog box before it's created
        device = config_ctrl_pnl.device_toedit
        gpio = config_ctrl_pnl.gpio_toedit
        wiring = config_ctrl_pnl.wiring_toedit

        # draw the pannel
        pnl = wx.Panel(self)
        wx.StaticText(self,  label='Device GPIO Config', pos=(20, 10))
        #background image
        png = wx.Image('./relaydialogue.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
        # devices combo box
        switch_list = self.list_switch_scripts()
        unlinked_devices = self.list_unused_devices(switch_list)
        wx.StaticText(self,  label='Device;', pos=(20, 50))
        self.devices_combo = wx.ComboBox(self, choices = unlinked_devices, pos=(90,50), size=(175, 25))
        self.devices_combo.SetValue(device)
        # gpio text box
        wx.StaticText(self,  label='GPIO', pos=(10, 100))
        self.gpio_tc = wx.TextCtrl(self, pos=(56, 98), size=(40, 25))
        self.gpio_tc.SetValue(gpio)
        self.gpio_tc.Bind(wx.EVT_CHAR, self.onChar) #limit to valid gpio numbers
        # wiring direction combo box
        wiring_choices = ['low', 'high']
        wx.StaticText(self,  label='Wiring side;', pos=(100, 100))
        self.wiring_combo = wx.ComboBox(self, choices = wiring_choices, pos=(200,98), size=(110, 25))
        self.wiring_combo.SetValue(wiring)
        #Buttom Row of Buttons
        okButton = wx.Button(self, label='Ok', pos=(200, 250))
        closeButton = wx.Button(self, label='Cancel', pos=(300, 250))
        okButton.Bind(wx.EVT_BUTTON, self.set_new_gpio_link)
        closeButton.Bind(wx.EVT_BUTTON, self.OnClose)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__( self, parent ):
        win_height = parent.GetSize()[1]
        win_width = parent.GetSize()[0]
        w_space_left = win_width - 285
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL )
        #set blank variables
        localfiles_info_pnl.local_path = ""
        ## Draw UI elements
        png = wx.Image('./localfiles.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight()))
        # placing the information boxes
        localfiles_info_pnl.local_path_txt = wx.StaticText(self,  label='local path', pos=(220, 80), size=(200,30))
        #local photo storage info
        localfiles_info_pnl.caps_folder = 'caps'
        localfiles_info_pnl.folder_text = wx.StaticText(self,  label=' ' + localfiles_info_pnl.caps_folder, pos=(720, 130), size=(200,30))
        localfiles_info_pnl.photo_text = wx.StaticText(self,  label='photo text', pos=(575, 166), size=(170,30))
        localfiles_info_pnl.first_photo_title = wx.StaticText(self,  label='first image', pos=(575, 290), size=(170,30))
        localfiles_info_pnl.last_photo_title = wx.StaticText(self,  label='last image', pos=(575, 540), size=(170,30))
        #file list boxes
        localfiles_info_pnl.config_files = self.config_file_list(self, 1, pos=(5, 160), size=(550, 200))
        localfiles_info_pnl.config_files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_config)
        localfiles_info_pnl.logs_files = self.logs_file_list(self, 1, pos=(5, 390), size=(550, 200))
        localfiles_info_pnl.logs_files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_logs)
        #localfiles_info_pnl.config_files = self.config_file_list(self, 1, pos=(5, 160), size=(550, 200))
    #    localfiles_info_pnl.config_files.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_config)
        #cron info text
        localfiles_info_pnl.cron_info = wx.StaticText(self,  label='cron info', pos=(290, 635), size=(200,30))
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def draw_photo_folder_images(self, first_pic, last_pic):
        # load and display first image
        first = wx.Image(first_pic, wx.BITMAP_TYPE_ANY)
        first = first.Scale(225, 225, wx.IMAGE_QUALITY_HIGH)
        first = first.ConvertToBitmap()
        localfiles_info_pnl.photo_folder_first_pic = wx.StaticBitmap(self, -1, first, (620, 310), (first.GetWidth(), first.GetHeight()))
        # load and display last image
        last = wx.Image(last_pic, wx.BITMAP_TYPE_ANY)
        last = last.Scale(225, 225, wx.IMAGE_QUALITY_HIGH)
        last = last.ConvertToBitmap()
        localfiles_info_pnl.photo_folder_last_pic = wx.StaticBitmap(self, -1, last, (620, 565), (last.GetWidth(), last.GetHeight()))
项目:pinder    作者:dhharris    | 项目源码 | 文件源码
def display_matches(self):
        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.images = []
        self.labels = []
        m = self.session.matches()

        for i in range(len(m)):
            match = m[i]
            # Thumb
            fd = urlopen(match.user.thumbnails[0])
            file = io.BytesIO(fd.read())
            img = wx.Image(file, wx.BITMAP_TYPE_ANY)
            self.images.append(wx.StaticBitmap(self.panel, wx.ID_ANY,
                                         wx.Bitmap(img)))
            self.images[i].Bind(wx.EVT_BUTTON, self.onClick)
            # Label for name
            self.labels.append(wx.StaticText(self.panel, label=match.user.name))

            # Add to sizer
            self.mainSizer.Add(self.labels[i], 0, wx.ALL, 5)
            self.mainSizer.Add(self.images[i], 0, wx.ALL, 5)

        self.mainSizer.Add(self.sizer, 0, wx.ALL, 5)
        self.panel.SetSizer(self.mainSizer)
        self.panel.Layout()
        self.panel.Refresh()
项目:GoPiGo3    作者:DexterInd    | 项目源码 | 文件源码
def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,id,title,size=(475,600))
        self.parent = parent
        self.initialize()
        # Exit
        exit_button = wx.Button(self, label="Exit", pos=(240+75,550))
        exit_button.Bind(wx.EVT_BUTTON, self.onClose)

        # robot = "/home/pi/Desktop/GoBox/Troubleshooting_GUI/dex.png"
        # png = wx.Image(robot, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        # wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth()-320, png.GetHeight()-20))
        # self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)        # Sets background picture

    #----------------------------------------------------------------------
项目:ChiantiPy    作者:chianti-atomic    | 项目源码 | 文件源码
def __set_properties(self):
        # begin wxGlade: ui_choice2Dialog.__set_properties
        self.SetTitle("ChiantiPy")
        _icon = wx.EmptyIcon()
        imagefile = os.path.join(chianti.__path__[0], "images/chianti2.png")
        _icon.CopyFromBitmap(wx.Bitmap(imagefile, wx.BITMAP_TYPE_ANY))
        self.SetIcon(_icon)
        self.SetSize((448, 556))
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: sampoorna_win.__init__
        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.STAY_ON_TOP | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.panel_warning = wx.Panel(self.panel_1, wx.ID_ANY, style=wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL)
        self.label_1 = wx.StaticText(self.panel_warning, wx.ID_ANY, _("label_1"))
        self.panel_login = wx.Panel(self.panel_1, wx.ID_ANY)
        self.bitmap_1 = wx.StaticBitmap(self.panel_login, wx.ID_ANY, wx.Bitmap("/home/ghssvythiri/Desktop/about.jpeg", wx.BITMAP_TYPE_ANY))
        self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_2"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "")
        self.label_3 = wx.StaticText(self.panel_login, wx.ID_ANY, _("label_3"))
        self.text_ctrl_2 = wx.TextCtrl(self.panel_login, wx.ID_ANY, "", style=wx.TE_PASSWORD)
        self.button_1 = wx.Button(self.panel_login, wx.ID_ANY, _("button_1"))
        self.panel_class = wx.Panel(self.panel_1, wx.ID_ANY)
        self.checkbox_1 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_1"))
        self.checkbox_2 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_2"))
        self.checkbox_3 = wx.CheckBox(self.panel_class, wx.ID_ANY, _("checkbox_3"))
        self.button_2 = wx.Button(self.panel_class, wx.ID_ANY, _("button_2"))
        self.panel_progress = wx.Panel(self.panel_1, wx.ID_ANY)
        self.panel_report = wx.Panel(self.panel_1, wx.ID_ANY)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_next, self.button_2)
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def validate_photo(self,path):
        import wx

        img = wx.Image(path, wx.BITMAP_TYPE_ANY)
            # scale the image, preserving the aspect ratio
        W=img.GetWidth()
        H=img.GetHeight()
        if W>120 or H>120 or W<100 or H<100:
            return False," Image Height and Width must be between 100-120 pixels"

        return [True]
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def reset_photo(self,default=False):

        print "changing photo"
        cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))


        if default:    


            path=cur_dir+"/Resources/img/browse.jpg"


        else:

            path=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"

            if not os.path.isfile(path):

                path=cur_dir+"/Resources/img/browse.jpg"


        if self.path!=path:# changes only if it has changed
            self.bitmap_photo = wx.BitmapButton(self.panel_1, wx.ID_ANY,wx.Bitmap(path, wx.BITMAP_TYPE_ANY))

            #self.bitmap_photo.SetBitmapSelected( wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
            selected_index=0
            print self.combo_box_adno.GetSelection()
            if self.combo_box_adno.GetSelection()>0:
                selected_index=self.combo_box_adno.GetItems().index(self.current_admission_no)
            self.__set_properties()
            self.__do_layout()
            self.combo_box_adno.SetSelection(selected_index)
            self.bitmap_photo.Enable(True)
            self.path=path
项目:jasper-modules    作者:mattcurrycom    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("/home/john/Pictures/jasper gui jarvis/jarvisrotator.png", wx.BITMAP_TYPE_ANY))

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
项目:jasper-modules    作者:mattcurrycom    | 项目源码 | 文件源码
def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle(_("frame_1"))
        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(wx.Bitmap("/home/john/Pictures/jasper gui jarvis/jarvisrotator.png", wx.BITMAP_TYPE_ANY))
        self.SetIcon(_icon)
        # end wxGlade
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def switchPanels(self):
        active = self.active
        self.panelStart.Hide()
        self.panelDrinks.Hide()
        self.panelUsers.Hide()
        self.panelThanks.Hide()
        self.panelSorry.Hide()
        self.panelRFID.Hide()
        if active == 0:
            if settings.enableRFID:
                self.rfid.start()
            self.panelStart.Show()
        elif active == 1:
            if not settings.onlyOneDrink:
                self.panelDrinks.l_amount.SetLabel("%02d" % 1)
            self.panelDrinks.l_user.SetLabel(self.user.longname)
            self.panelDrinks.Show()
        elif active == 2:
            self.panelUsers.Show()
        elif active == 3:
            self.panelThanks.label_1.SetLabel(self.user.longname + "\n" + "%02d x " % int(self.panelDrinks.GetAmount()) + self.drinkl.split('\n')[0])
            self.panelThanks.label_1.Wrap(340)
            try:
                self.panelThanks.bitmap_2.SetBitmap(wx.Bitmap("./app/static/product_%s.png" % self.drinkl.split('\n')[0], wx.BITMAP_TYPE_ANY))
            except:
                logging.error("no picture for drink: " + self.drinkl.split('\n')[0])
            self.panelThanks.Show()
            self.delayExit()
        elif active == 4:
            self.panelSorry.label_1.SetLabel(self.user.longname)
            self.panelSorry.Show()
        else: #active == 5:
            self.panelRFID.label_1.SetLabel(self.rfidid)
            self.panelRFID.Show()
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/start.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        if not settings.hideGuiList:
            self.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
            self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))

        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/thanks.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        self.bitmap_2 = wx.StaticBitmap(self, wx.ID_ANY, wx.NullBitmap, pos=(10, 10))

        self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(120, 50), size=(340, 100))
        self.label_1.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.label_1.SetForegroundColour("white")
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/sorry.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
        self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
        self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/rfid.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
        self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100), size=(100,220))
        self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.parent = parent
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/users.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))

        users = get_users()
        self.names = list()
        for user in users:
            if user.isshown and not user.onlyrfid:
                self.names.append(user.longname)

        self.but_names = list()
    self.position = 0
    self.lines = 4
    self.items = len(self.names) 

    for i in range(self.lines):
            #480x320
            self.but = wx.lib.platebtn.PlateButton(self, label=self.names[self.position+i] if self.position+i < len(self.names) else "", pos=(3, 3+i*80),
                                                   style=wx.BU_EXACTFIT | wx.lib.platebtn.PB_STYLE_SQUARE)
            self.but.SetSize((365, 74))

            self.but.SetBackgroundColour((255-(i*20 % 40), (160+(i*50 % 100)), 0))
            #self.but.SetForegroundColour("#006699")
            self.but.SetPressColor(wx.Colour(255,255,255,0))
            self.but.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
            self.but.Bind(wx.EVT_LEFT_DOWN, parent.onUser, id=self.but.Id)
            self.but_names.append(self.but)

        self.b_up = wx.Button(self, id=wx.ID_ANY, label=u"\u25B2", pos=(374, 0), size=(106, 106))
        self.b_up.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_up.Bind(wx.EVT_LEFT_DOWN, self.on_up, id=self.b_up.Id)

        self.b_down = wx.Button(self, id=wx.ID_ANY, label=u"\u25BC", pos=(374, 214), size=(106, 106))
        self.b_down.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_down.Bind(wx.EVT_LEFT_DOWN, self.on_down, id=self.b_down.Id)

        self.b_exit = wx.Button(self, id=wx.ID_ANY, label="X", pos=(374, 107), size=(106, 106))
        self.b_exit.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id)
        self.Layout()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, parent, id):
        # create the panel
        wx.Panel.__init__(self, parent, id)
        try:
            # pick an image file you have in the working
            # folder you can load .jpg  .png  .bmp  or
            # .gif files
            image_file = 'big_cat.jpg'
            bmp1 = wx.Image(
                image_file,
                wx.BITMAP_TYPE_ANY).ConvertToBitmap()
            # image's upper left corner anchors at panel
            # coordinates (0, 0)
            self.bitmap1 = wx.StaticBitmap(
                self, -1, bmp1, (0, 0))
            # show some image details
            str1 = "%s  %dx%d" % (image_file, bmp1.GetWidth(),
                                  bmp1.GetHeight())
            parent.SetTitle(str1)
        except IOError:
            print("Image file %s not found" % imageFile)
            raise SystemExit

        # button goes on the image --> self.bitmap1 is the
        # parent
        self.button1 = wx.Button(
            self.bitmap1, label='Button1',
            pos=(8, 8))
项目:signal_hunter    作者:billautomata    | 项目源码 | 文件源码
def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=930000000,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=930000000,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/bill/signal_hunter/out.iq', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: student_profie.__init__
        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE | wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.CLIP_CHILDREN
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.Panel(self, wx.ID_ANY, style=wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
        self.combo_box_13 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.combo_box_14 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.combo_box_15 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.button_1 = wx.Button(self.panel_1, wx.ID_ANY, _("Add New"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_CENTRE)
        self.bitmap_button_2 = wx.BitmapButton(self.panel_1, wx.ID_ANY, wx.Bitmap("/media/ghssvythiri/10C63D64C63D4AEC/asif/sqlite_working_aug_16/Resources/img/pass.jpg", wx.BITMAP_TYPE_ANY), style=wx.BU_AUTODRAW)
        self.static_line_1 = wx.StaticLine(self.panel_1, wx.ID_ANY)
        self.bitmap_button_1 = wx.BitmapButton(self.panel_1, wx.ID_ANY, wx.Bitmap("/media/ghssvythiri/10C63D64C63D4AEC/asif/sqlite_working_aug_16/Resources/img/exit.jpg", wx.BITMAP_TYPE_ANY))
        self.label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Name"))
        self.label_2 = wx.StaticText(self.panel_1, wx.ID_ANY, _("UID"))
        self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Gender"))
        self.text_ctrl_2 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_3 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.combo_box_16 = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Date of Birth"))
        self.label_5 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Category"))
        self.label_6 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Reigion"))
        self.text_ctrl_4 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_5 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_6 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.label_7 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Caste"))
        self.label_8 = wx.StaticText(self.panel_1, wx.ID_ANY, _("First Language"))
        self.label_9 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Father"))
        self.text_ctrl_7 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_8 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_9 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.label_10 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Mother"))
        self.label_11 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Mobile"))
        self.label_12 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Email"))
        self.text_ctrl_10 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_11 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.text_ctrl_12 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
        self.hyperlink_1 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "")
        self.hyperlink_2 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "")
        self.hyperlink_3 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "")
        self.static_line_2 = wx.StaticLine(self.panel_1, wx.ID_ANY)
        self.button_3 = wx.Button(self.panel_1, wx.ID_ANY, _("Delete"))
        self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, _("Close"))
        self.button_4 = wx.Button(self.panel_1, wx.ID_ANY, _("Save"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_search, self.bitmap_button_2)
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_save(self, event):  # wxGlade: student_profie.<event_handler>


        if self.button_save.Label=="Edit":
            self.on_edit()
            self.button_delete.Disable()
        else:
        # if button save


            if self.text_ctrl_name.Value and self.combo_box_adno.GetValue():



                if not self.validate_all():
                    event.Skip()
                    return 0

                if self.add_flag:
                    result=self.db_insert()
                else:
                    result=self.db_update()
                if result:
                    if self.prof_pic_path!='':
                        from shutil import copyfile
                        cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))

                        dest=cur_dir+"/Resources/profile_pic/"+str(self.current_admission_no)+".jpg"

                        copyfile(self.prof_pic_path,dest)

                    self.load_admission_no()
                    self.button_save.Disable()
            else:
                msg= "Admission number and name mandatory"

                dlg = wx.MessageDialog(self, msg, '',wx.OK | wx.ICON_ERROR)                  
                dlg.ShowModal()
                dlg.Destroy()

            self.button_save.Label="Edit"
            self.set_editable(False)
            self.bitmap_photo.Enable(False)

            cur_dir=os.path.dirname(os.path.abspath((sys.argv[0])))
            path=cur_dir+"/Resources/img/browse.jpg"
            self.bitmap_photo = wx.BitmapButton(self.panel_1, wx.ID_ANY,wx.Bitmap(path, wx.BITMAP_TYPE_ANY))
            self.__set_properties()
            self.__do_layout()




        event.Skip()