python类NORMAL的实例源码

add_div.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: add_div.__set_properties
        self.SetTitle("Year & Division")
        self.SetSize((600, 500))
        #self.Enable(False)
        self.SetFocus()
        self.label_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_1.SetSelection(0)
        self.label_2.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_2.SetSelection(0)
        self.list_box_1.SetMinSize((150, 257))
        self.list_box_1.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.list_box_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.button_1.SetMinSize((120, 40))
        self.text_ctrl_1.SetMinSize((90, 33))
        self.text_ctrl_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_1.Value='Eg: A-K'
        self.text_ctrl_1.SetForegroundColour('#9CA998')
        self.button_2.SetMinSize((120, 40))
        self.button_1.Enable(False)
        self.button_2.Enable(False)
        self.button_3.SetMinSize((85, 35))
        self.panel_1.SetScrollRate(10, 10)


        # end wxGlade
wxTerminal.py 文件源码 项目:Jackal_Velodyne_Duke 作者: MengGuo 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: TerminalFrame.__set_properties
        self.SetTitle("Serial Terminal")
        self.SetSize((546, 383))
        self.text_ctrl_output.SetFont(wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, ""))
        # end wxGlade
gui.py 文件源码 项目:baroness 作者: ulrichknecht 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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")
gui.py 文件源码 项目:baroness 作者: ulrichknecht 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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"))
gui.py 文件源码 项目:baroness 作者: ulrichknecht 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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"))
gui.py 文件源码 项目:baroness 作者: ulrichknecht 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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/products.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))

        products = get_products()
        buttonids = []
        i = 0
        for product in products:
            if product.isshown:
                #480x320
                self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + u"%0.2f" % product.price, pos=((i%4)*120, int(i/4)*120), size=(120, 120))
                self.but.SetBackgroundColour((255-((i+int(i/4))*20 % 40), (160+((i+int(i/4))*50 % 100)), 0))
                #self.but.SetForegroundColour("#006699")
                self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
                self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id)
                i += 1

        if not settings.onlyOneDrink:
            self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,250), size=(120, 70))
            self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
            self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id)

            self.l_amount = wx.StaticText(self, wx.ID_ANY, "%2d" % 0, pos=(137, 245), style=wx.ALIGN_CENTER)
            self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))

            self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,250), size=(120, 70))
            self.b_more.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
            self.b_more.Bind(wx.EVT_LEFT_DOWN, self.onMore, id=self.b_more.Id)

        self.b_exit = wx.Button(self, id = wx.ID_ANY, label=u"x", pos=(360,250), size=(120, 70))
        self.b_exit.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id)

        if i <= 4:
            self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=(20,170), style=wx.ALIGN_CENTER)
        else:
            self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=((i%4)*120+20,170), style=wx.ALIGN_CENTER)
        self.l_user.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
gui.py 文件源码 项目:baroness 作者: ulrichknecht 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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()
py_drop_target.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)
        font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False)

        # create and setup first set of widgets
        lbl = wx.StaticText(self, 
                            label="Drag some URLS from your browser here:")
        lbl.SetFont(font)
        self.dropText = wx.TextCtrl(
            self, size=(200,200), 
            style=wx.TE_MULTILINE|wx.HSCROLL|wx.TE_READONLY)
        dt = MyURLDropTarget(self.dropText)
        self.dropText.SetDropTarget(dt)
        firstSizer = self.addWidgetsToSizer([lbl, self.dropText])

        # create and setup second set of widgets
        lbl = wx.StaticText(self, label="Drag this URL to your browser:")
        lbl.SetFont(font)
        self.draggableURLText = wx.TextCtrl(self, 
                                            value="http://www.mousevspython.com")
        self.draggableURLText.Bind(wx.EVT_MOTION, self.OnStartDrag)
        secondSizer = self.addWidgetsToSizer([lbl, self.draggableURLText])

        # Add sizers to main sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(firstSizer, 0, wx.EXPAND)
        mainSizer.Add(secondSizer, 0, wx.EXPAND)
        self.SetSizer(mainSizer)
flashing_text.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        self.label = "I flash a LOT!"
        self.flashingText = wx.StaticText(self, label=self.label)
        self.flashingText.SetFont(self.font)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer.Start(1000)
changing_text.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        self.flashingText = wx.StaticText(self, label="I flash a LOT!")
        self.flashingText.SetFont(self.font)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer.Start(1000)
main.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, parent, label="Close"):
        """Constructor"""
        font = wx.Font(16, wx.SWISS, wx.NORMAL, wx.BOLD)
        img = wx.Bitmap(r"%s/images/cancel.png" % appPath)
        GenBitmapTextButton.__init__(self, parent, wx.ID_CLOSE, img,
                                     label=label, size=(110, 50))
        self.SetFont(font)
mobile_insight_gui.py 文件源码 项目:mobileinsight-core 作者: mobile-insight 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, start_time, end_time):
        wx.Dialog.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetTitle("Time Window")
        self.start_label = wx.StaticText(self, -1, label="...", style=wx.BOLD)
        self.end_label = wx.StaticText(self, -1, label="...", style=wx.BOLD)
        self.window_label = wx.StaticText(self, -1, "\t to \t")
        # self.start_label.SetFont(wx.Font(11, wx.DEFAULT, wx.BOLD, wx.NORMAL))
        # self.window_label.SetFont(wx.Font(11, wx.DEFAULT, wx.ITALIC, wx.NORMAL))
        # self.end_label.SetFont(wx.Font(11, wx.DEFAULT, wx.BOLD, wx.NORMAL))

        self.start_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL))
        self.window_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_NORMAL))
        self.end_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_SLANT, wx.FONTWEIGHT_NORMAL))

        labelSizer = wx.BoxSizer(wx.HORIZONTAL)
        labelSizer.Add(self.start_label, 0, wx.ALL | wx.EXPAND, 3)
        labelSizer.Add(self.window_label, wx.ALL, 1)
        labelSizer.Add(self.end_label, 0, wx.ALL | wx.EXPAND, 3)

        self.btns = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
        start_sizer = wx.BoxSizer(wx.HORIZONTAL)
        start_sizer.Add(wx.StaticText(self, -1, "Start: "), 0, wx.ALL, 1)
        self.start_slider = wx.Slider(
            self, -1, 0, 0, 100, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL)
        start_sizer.Add(self.start_slider, 0, wx.ALL | wx.EXPAND, 5)
        self.Bind(wx.EVT_SLIDER, self.start_slider_update, self.start_slider)

        end_sizer = wx.BoxSizer(wx.HORIZONTAL)
        end_sizer.Add(wx.StaticText(self, -1, "End: "), 0, wx.ALL, 1)
        self.end_slider = wx.Slider(
            self, -1, 100, 0, 100, wx.DefaultPosition, (250, -1), wx.SL_HORIZONTAL)
        end_sizer.Add(self.end_slider, 0, wx.ALL | wx.EXPAND, 5)
        self.Bind(wx.EVT_SLIDER, self.end_slider_udpate, self.end_slider)

        self.start_time = start_time
        self.cur_end = end_time
        self.cur_start = self.start_time
        self.unit_seconds = (end_time - start_time).total_seconds() / 100.0

        self.updateUI()
        sizer.Add(labelSizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(start_sizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(end_sizer, 0, wx.ALL | wx.EXPAND, 5)
        sizer.Add(self.btns, 0, wx.ALL | wx.EXPAND, 5)
        self.SetSizer(sizer)
        self.Fit()
fits_header_dialog.py 文件源码 项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def __init__(self, parent, raw_header_str, caption,
                 pos=wx.DefaultPosition, size=(500,300),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
        self.parent = parent
        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        x, y = pos
        if x == -1 and y == -1:
            self.CenterOnScreen(wx.BOTH)
        self.cur_selection = (0, 0)
        self.raw_header_str = raw_header_str
        self.raw_header_str_lower = raw_header_str.lower()
        self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY)

        font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False)
        self.text.SetFont(font1)
        self.text.SetInitialSize((600,400))

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5)
        ok = wx.Button(self, wx.ID_OK, "OK")
        ok.SetDefault()
        ok.Bind(wx.EVT_BUTTON, self.on_close)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
        self.search.ShowSearchButton(True)
        self.search.ShowCancelButton(True)
        # TODO:  make layout of search & OK button prettier (OK should be right-aligned properly)
        buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND)
        buttons_sizer.Add((315, 0), 1, wx.EXPAND)
        buttons_sizer.Add(ok, 0, wx.ALL)
        main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4)
        self.SetSizerAndFit(main_sizer)
        self.set_cur_selection()
        self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search)
        self.last_search_str = ''
        self.last_find_index = 0
        self.is_dialog_still_open = True
        self.Bind(wx.EVT_CLOSE, self.on_close)
        new_id = wx.NewId()
        self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id)
        self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
fits_header_dialog.py 文件源码 项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, raw_header_str, caption,
                 pos=wx.DefaultPosition, size=(500,300),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
        self.parent = parent
        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        x, y = pos
        if x == -1 and y == -1:
            self.CenterOnScreen(wx.BOTH)
        self.cur_selection = (0, 0)
        self.raw_header_str = raw_header_str
        self.raw_header_str_lower = raw_header_str.lower()
        self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY)

        font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False)
        self.text.SetFont(font1)
        self.text.SetInitialSize((600,400))

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5)
        ok = wx.Button(self, wx.ID_OK, "OK")
        ok.SetDefault()
        ok.Bind(wx.EVT_BUTTON, self.on_close)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
        self.search.ShowSearchButton(True)
        self.search.ShowCancelButton(True)
        # TODO:  make layout of search & OK button prettier (OK should be right-aligned properly)
        buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND)
        buttons_sizer.Add((315, 0), 1, wx.EXPAND)
        buttons_sizer.Add(ok, 0, wx.ALL)
        main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4)
        self.SetSizerAndFit(main_sizer)
        self.set_cur_selection()
        self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search)
        self.last_search_str = ''
        self.last_find_index = 0
        self.is_dialog_still_open = True
        self.Bind(wx.EVT_CLOSE, self.on_close)
        new_id = wx.NewId()
        self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id)
        self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
gui-wx.py 文件源码 项目:specto 作者: mrknow 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent, title):
            wx.Frame.__init__(self, parent, -1, title,
                              pos=(150, 150), size=(350, 200))

            # Create the menubar
            menuBar = wx.MenuBar()

            # and a menu
            menu = wx.Menu()

            # add an item to the menu, using \tKeyName automatically
            # creates an accelerator, the third param is some help text
            # that will show up in the statusbar
            menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample")

            # bind the menu event to an event handler
            self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT)

            # and put the menu on the menubar
            menuBar.Append(menu, "&File")
            self.SetMenuBar(menuBar)

            self.CreateStatusBar()

            # Now create the Panel to put the other controls on.
            panel = wx.Panel(self)

            # and a few controls
            text = wx.StaticText(panel, -1, "Hello World!")
            text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
            text.SetSize(text.GetBestSize())
            btn = wx.Button(panel, -1, "Close")
            funbtn = wx.Button(panel, -1, "Just for fun...")

            # bind the button events to handlers
            self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn)
            self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn)

            # Use a sizer to layout the controls, stacked vertically and with
            # a 10 pixel border around each
            sizer = wx.BoxSizer(wx.VERTICAL)
            sizer.Add(text, 0, wx.ALL, 10)
            sizer.Add(btn, 0, wx.ALL, 10)
            sizer.Add(funbtn, 0, wx.ALL, 10)
            panel.SetSizer(sizer)
            panel.Layout()
IDEFrame.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def OnPrintPage(self, page):
        dc = self.GetDC()
        dc.SetUserScale(1.0, 1.0)
        dc.SetDeviceOrigin(0, 0)
        dc.printing = not self.Preview

        # Get the size of the DC in pixels
        ppiPrinterX, ppiPrinterY = self.GetPPIPrinter()
        ppiScreenX, ppiScreenY = self.GetPPIScreen()
        pw, ph = self.GetPageSizePixels()
        dw, dh = dc.GetSizeTuple()
        Xscale = (float(dw) * float(ppiPrinterX)) / (float(pw) * 25.4)
        Yscale = (float(dh) * float(ppiPrinterY)) / (float(ph) * 25.4)

        fontsize = self.FontSize * Yscale
        text_margin = self.TextMargin * Yscale

        margin_left = self.Margins[0].x * Xscale
        margin_top = self.Margins[0].y * Yscale
        area_width = dw - self.Margins[1].x * Xscale - margin_left
        area_height = dh - self.Margins[1].y * Yscale - margin_top

        dc.SetPen(MiterPen(wx.BLACK))
        dc.SetBrush(wx.TRANSPARENT_BRUSH)
        dc.DrawRectangle(margin_left, margin_top, area_width, area_height)

        dc.SetFont(wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.NORMAL))
        dc.SetTextForeground(wx.BLACK)
        block_name = " - ".join(self.Viewer.GetTagName().split("::")[1:])
        text_width, text_height = dc.GetTextExtent(block_name)
        dc.DrawText(block_name, margin_left, margin_top - text_height - self.TextMargin)
        dc.DrawText(_("Page: %d") % page, margin_left, margin_top + area_height + self.TextMargin)

        # Calculate the position on the DC for centering the graphic
        posX = area_width * ((page - 1) % self.PageGrid[0])
        posY = area_height * ((page - 1) / self.PageGrid[0])

        scaleX = float(area_width) / float(self.PageSize[0])
        scaleY = float(area_height) / float(self.PageSize[1])
        scale = min(scaleX, scaleY)

        # Set the scale and origin
        dc.SetDeviceOrigin(-posX + margin_left, -posY + margin_top)
        dc.SetClippingRegion(posX, posY, self.PageSize[0] * scale, self.PageSize[1] * scale)
        dc.SetUserScale(scale, scale)

        self.Viewer.DoDrawing(dc, True)

        return True
Viewer.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def DoDrawing(self, dc, printing=False):
        if printing:
            if getattr(dc, "printing", False):
                font = wx.Font(self.GetFont().GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
                dc.SetFont(font)
            else:
                dc.SetFont(self.GetFont())
        else:
            dc.SetBackground(wx.Brush(self.Editor.GetBackgroundColour()))
            dc.Clear()
            dc.BeginDrawing()
        if self.Scaling is not None and self.DrawGrid and not printing:
            dc.SetPen(wx.TRANSPARENT_PEN)
            dc.SetBrush(self.GridBrush)
            xstart, ystart = self.GetViewStart()
            window_size = self.Editor.GetClientSize()
            width, height = self.Editor.GetVirtualSize()
            width = int(max(width, xstart * SCROLLBAR_UNIT + window_size[0]) / self.ViewScale[0])
            height = int(max(height, ystart * SCROLLBAR_UNIT + window_size[1]) / self.ViewScale[1])
            dc.DrawRectangle(1, 1, width, height)
        if self.PageSize is not None and not printing:
            dc.SetPen(self.PagePen)
            xstart, ystart = self.GetViewStart()
            window_size = self.Editor.GetClientSize()
            for x in xrange(self.PageSize[0] - (xstart * SCROLLBAR_UNIT) % self.PageSize[0], int(window_size[0] / self.ViewScale[0]), self.PageSize[0]):
                dc.DrawLine(xstart * SCROLLBAR_UNIT + x + 1, int(ystart * SCROLLBAR_UNIT / self.ViewScale[0]),
                            xstart * SCROLLBAR_UNIT + x + 1, int((ystart * SCROLLBAR_UNIT + window_size[1]) / self.ViewScale[0]))
            for y in xrange(self.PageSize[1] - (ystart * SCROLLBAR_UNIT) % self.PageSize[1], int(window_size[1] / self.ViewScale[1]), self.PageSize[1]):
                dc.DrawLine(int(xstart * SCROLLBAR_UNIT / self.ViewScale[0]), ystart * SCROLLBAR_UNIT + y + 1,
                            int((xstart * SCROLLBAR_UNIT + window_size[0]) / self.ViewScale[1]), ystart * SCROLLBAR_UNIT + y + 1)

        # Draw all elements
        for comment in self.Comments.itervalues():
            if comment != self.SelectedElement and (comment.IsVisible() or printing):
                comment.Draw(dc)
        for wire in self.Wires.iterkeys():
            if wire != self.SelectedElement and (wire.IsVisible() or printing):
                if not self.Debug or not wire.GetValue():
                    wire.Draw(dc)
        if self.Debug:
            for wire in self.Wires.iterkeys():
                if wire != self.SelectedElement and (wire.IsVisible() or printing) and wire.GetValue():
                    wire.Draw(dc)
        for block in self.Blocks.itervalues():
            if block != self.SelectedElement and (block.IsVisible() or printing):
                block.Draw(dc)

        if self.SelectedElement is not None and (self.SelectedElement.IsVisible() or printing):
            self.SelectedElement.Draw(dc)

        if not printing:
            if self.Debug:
                self.InstanceName.Draw(dc)
            if self.rubberBand.IsShown():
                self.rubberBand.Draw(dc)
            dc.EndDrawing()
student_profile.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: student_profie.__set_properties
        self.SetTitle(_("Student Profile"))
        self.label_13.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.label_14.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_year.SetMinSize((350, 35))
        self.combo_box_class.SetMinSize((350, 35))
        self.label_16.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.label_17.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_div.SetMinSize((350, 35))
        self.combo_box_name.SetMinSize((350, 35))
        self.combo_box_name.SetSelection(0)
        self.bitmap_photo.SetMinSize((132, 132))
        self.button_add.SetMinSize((129, 38))
        self.button_add.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Ubuntu"))
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_3.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_roll.SetMinSize((300, 35))
        self.text_ctrl_name.SetMinSize((300, 35))
        self.text_ctrl_uid.SetMinSize((300, 35))
        self.label_4.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_5.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_6.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.combo_box_gender.SetMinSize((100, 35))
        self.combo_box_gender.SetSelection(0)
        self.text_ctrl_dob.SetMinSize((300, 35))
        self.text_ctrl_category.SetMinSize((300, 35))
        self.label_7.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_8.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_9.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_religion.SetMinSize((300, 35))
        self.text_ctrl_caste.SetMinSize((300, 35))
        self.text_ctrl_language.SetMinSize((300, 35))
        self.label_10.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_11.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_12.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_father.SetMinSize((300, 35))
        self.text_ctrl_mother.SetMinSize((300, 35))
        self.text_ctrl_mobile.SetMinSize((300, 35))
        self.label_18.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_email.SetMinSize((300, 35))
        self.static_line_2.SetMinSize((1130, 10))
        self.button_close.SetMinSize((120, 45))
        self.button_delete.SetMinSize((120, 45))
        self.button_save.SetMinSize((120, 45))
        # end wxGlade
sampoorna_gui_old.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: sampoorna_win.__set_properties
        self.SetTitle(("Import from Sampoorna"))
        self.SetSize((894, 700))
        self.label_1.SetForegroundColour(wx.Colour(204, 50, 50))
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.label_2.SetForegroundColour(wx.Colour(95, 159, 159))
        self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.label_3.SetForegroundColour(wx.Colour(185, 115, 45))
        self.label_3.SetFont(wx.Font(11, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_user.SetMinSize((250, 35))
        self.label_4.SetForegroundColour(wx.Colour(185, 115, 45))
        self.label_4.SetFont(wx.Font(11, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_passw.SetMinSize((250,35))
        self.panel_1.SetBackgroundColour(wx.Colour(193, 193, 255))
        self.button_next.SetMinSize((100, 35))
        self.login_pane.SetBackgroundColour(wx.Colour(249, 249, 248))
        self.login_pane.SetFocus()
        self.checkbox_8.SetMinSize((100, 30))
        self.checkbox_9.SetMinSize((100, 30))
        self.checkbox_10.SetMinSize((120, 30))
        self.panel_3.SetBackgroundColour(wx.Colour(193, 193, 255))
        self.button_previous.SetMinSize((100, 35))
        self.button_proceed.SetMinSize((100, 35))
        self.standard_pane.SetBackgroundColour(wx.Colour(249, 249, 248))
        self.standard_pane.Hide()
        self.progresss_total.SetMinSize((400, 30))
        self.label_progress_perc.SetMinSize((400, 30))
        self.text_ctrl_report.SetMinSize((450, 400))
        self.text_ctrl_report.SetBackgroundColour(wx.Colour(204, 204, 204))
        self.text_ctrl_report.SetForegroundColour(wx.Colour(17, 17, 71))
        self.text_ctrl_report.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.button_finished.SetMinSize((100, 35))
        self.panel_2.SetBackgroundColour(wx.Colour(193, 193, 255))
        self.report_pane.SetBackgroundColour(wx.Colour(249, 249, 248))
        self.report_pane.Hide()
        #self.button_finished.Hide()
        #self.label_progress_perc.Hide()
        self.button_next.Disable()
        self.button_proceed.Disable()

        # end wxGlade
student_profile.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: student_profie.__set_properties
        self.SetTitle(("Student Profile"))
        self.label_13.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.label_14.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_year.SetMinSize((350, 35))
        self.combo_box_class.SetMinSize((350, 35))
        self.label_16.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.label_17.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_div.SetMinSize((350, 35))
        self.combo_box_adno.SetMinSize((350, 35))
        self.combo_box_adno.SetSelection(0)
        self.bitmap_photo.SetMinSize((132, 132))
        self.button_add.SetMinSize((129, 38))
        self.button_add.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Ubuntu"))
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_3.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_roll.SetMinSize((300, 35))
        self.text_ctrl_name.SetMinSize((300, 35))
        self.text_ctrl_uid.SetMinSize((300, 35))
        self.label_4.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_5.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_6.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.combo_box_gender.SetMinSize((100, 35))
        self.combo_box_gender.SetSelection(0)
        self.text_ctrl_dob.SetMinSize((300, 35))
        self.text_ctrl_category.SetMinSize((300, 35))
        self.label_7.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_8.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_9.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_religion.SetMinSize((300, 35))
        self.text_ctrl_caste.SetMinSize((300, 35))
        self.text_ctrl_language.SetMinSize((300, 35))
        self.label_10.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_11.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.label_12.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_father.SetMinSize((300, 35))
        self.text_ctrl_mother.SetMinSize((300, 35))
        self.text_ctrl_mobile.SetMinSize((300, 35))
        self.label_18.SetFont(wx.Font(12, wx.DEFAULT, wx.ITALIC, wx.BOLD, 0, ""))
        self.text_ctrl_email.SetMinSize((300, 35))
        self.static_line_2.SetMinSize((1130, 10))
        self.button_close.SetMinSize((120, 45))
        self.button_delete.SetMinSize((120, 45))
        self.button_delete.Enable(False)
        self.button_save.SetMinSize((120, 45))
        self.button_save.Enable(False)
        self.button_add.Enable(False)
        self.bitmap_photo.Enable(False)    

        # end wxGlade


问题


面经


文章

微信
公众号

扫码关注公众号