Exemple #1
0
    def OnOpenLogcatClicked(self, event):
        self.loadDataBase(2)
        self.SetSize(980, 560)
        grid = wx.grid.Grid(self, pos=(320, 0), size=(640, 500))
        grid.CreateGrid(100, 4)
        for i in range(100):
            for j in range(4):
                grid.SetCellAlignment(i, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        grid.SetColLabelValue(0, "工号")  #第一列标签
        grid.SetColLabelValue(1, "姓名")
        grid.SetColLabelValue(2, "打卡时间")
        grid.SetColLabelValue(3, "是否迟到")

        grid.SetColSize(0, 120)
        grid.SetColSize(1, 120)
        grid.SetColSize(2, 150)
        grid.SetColSize(3, 150)

        grid.SetCellTextColour("NAVY")
        for i, id in enumerate(self.logcat_id):
            grid.SetCellValue(i, 0, str(id))
            grid.SetCellValue(i, 1, self.logcat_name[i])
            grid.SetCellValue(i, 2, self.logcat_datetime[i])
            grid.SetCellValue(i, 3, self.logcat_late[i])

        pass
Exemple #2
0
    def OnOpenLogcatClicked(self, event):
        if user_now == ID_WORKER_UNAVIABLE:
            wx.MessageBox(message="未检测到用户,请进行识别", caption="警告")
        else:
            self.loadDataBase(2)
            # 必须要变宽才能显示 scroll
            self.SetSize(980, 560)
            grid = wx.grid.Grid(self, pos=(320, 0), size=(640, 500))
            grid.CreateGrid(100, 4)
            for i in range(100):
                for j in range(4):
                    grid.SetCellAlignment(i, j, wx.ALIGN_CENTER,
                                          wx.ALIGN_CENTER)
            grid.SetColLabelValue(0, "序号")  # 第一列标签
            grid.SetColLabelValue(1, "姓名")
            grid.SetColLabelValue(2, "识别时间")
            grid.SetColLabelValue(3, "操作")

            grid.SetColSize(0, 120)
            grid.SetColSize(1, 120)
            grid.SetColSize(2, 150)
            grid.SetColSize(3, 150)

            grid.SetCellTextColour(1, 1, 'red')
            for i, id in enumerate(self.logcat_id):
                grid.SetCellValue(i, 0, str(id))
                grid.SetCellValue(i, 1, self.logcat_name[i])
                grid.SetCellValue(i, 2, self.logcat_datetime[i])
                grid.SetCellValue(i, 3, self.logcat_late[i])

            pass
    def grid_setup(self):
        """Perform the initial setup and layout of the grid."""
        # @type grid wx.grid.Grid
        grid = self.panel.gridExp
        #General settings
        #grid.SetSelectionMode(wx.grid.Grid.wxGridSelectRows)
        #Label width/height
        grid.SetColLabelSize(40)
        grid.SetRowLabelSize(40)

        #Find that the grid should be
        num_angles = len(model.instrument.inst.angles)
        num_cols = 4 + num_angles
        if grid.GetNumberCols() > num_cols:
            grid.DeleteCols(0, grid.GetNumberCols() - num_cols)
        if grid.GetNumberCols() < num_cols:
            grid.AppendCols(num_cols - grid.GetNumberCols())

        #The column headers
        grid.SetColLabelValue(0, "Use?")
        grid.SetColSize(0, 50)
        #Column # of the criterion
        self.criterion_col = num_angles + 1
        grid.SetColLabelValue(self.criterion_col, "Stopping\nCriterion")
        grid.SetColSize(self.criterion_col, 180)
        grid.SetColLabelValue(self.criterion_col + 1, "Criterion\nValue")
        grid.SetColSize(self.criterion_col + 1, 100)
        grid.SetColLabelValue(self.criterion_col + 2, "Comment")
        grid.SetColSize(self.criterion_col + 2, 120)
        for (i, anginfo) in enumerate(model.instrument.inst.angles):
            grid.SetColLabelValue(
                i + 1, anginfo.name + "\n(" + anginfo.friendly_units + ")")
            grid.SetColSize(i + 1, 100)
Exemple #4
0
    def OnOpenRecordClicked(self, event):
        self.callDataBase(2)
        grid = wx.grid.Grid(self, pos=(320, 0), size=(600, 500))
        grid.CreateGrid(100, 4)
        for i in range(100):
            for j in range(4):
                grid.SetCellAlignment(i, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        grid.SetColLabelValue(0, "学号")
        grid.SetColLabelValue(1, "姓名")
        grid.SetColLabelValue(2, "签到时间")
        grid.SetColLabelValue(3, "是否迟到")

        grid.SetColSize(0, 100)
        grid.SetColSize(1, 100)
        grid.SetColSize(2, 150)
        grid.SetColSize(3, 150)

        grid.SetCellTextColour("NAVY")
        for i, id in enumerate(self.Sign_Info_id):
            grid.SetCellValue(i, 0, str(id))
            grid.SetCellValue(i, 1, self.Sign_Info_name[i])
            grid.SetCellValue(i, 2, self.Sign_Info_time_info[i])
            grid.SetCellValue(i, 3, self.Sign_Info_if_late[i])

        pass
Exemple #5
0
def setup_grid(grid, title):
    """
    This function only works with type wx.grid.Grid
    The it will create a grid that is like the one found in LinkCtrl/View.
    :param grid:
    :return:
    """

    grid.CreateGrid(6, 2)
    grid.EnableEditing(False)
    grid.EnableGridLines(True)
    grid.SetGridLineColour(wx.Colour(0, 0, 0))
    grid.EnableDragGridSize(False)

    # Columns
    grid.EnableDragColMove(False)
    grid.EnableDragColSize(True)
    grid.SetColLabelSize(0)
    grid.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)
    grid.SetColSize(0, 110)

    # Rows
    grid.EnableDragRowSize(True)
    grid.SetRowLabelSize(0)
    grid.SetRowLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)

    # Defaults
    grid.SetDefaultCellBackgroundColour(wx.Colour(255, 255, 255))  # white
    grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP)

    # Set Cell Values
    grid.SetCellValue(0, 0, " %s" % title)
    grid.SetCellValue(1, 0, " Variable Name")
    grid.SetCellValue(2, 0, " Geometry Type")
    grid.SetCellValue(3, 0, " Geometry Count")
    grid.SetCellValue(4, 0, " Coordinate System")
    grid.SetCellValue(5, 0, " Spatial Extent")

    # set the default background color
    grid.SetDefaultCellBackgroundColour('WHITE')

    # change color and size of header
    grid.SetCellSize(0, 0, 1, 2)  # span cols 0 and 1
    grid.SetCellBackgroundColour(0, 0, wx.Colour(195, 195, 195))  # Grey

    # set the table column size
    grid.SetColSize(0, 133)
    grid.SetColSize(1, 155)

    # change color of properties
    for i in range(1, grid.GetNumberRows()):
        grid.SetCellBackgroundColour(i, 0, wx.Colour(250, 250,
                                                     250))  # light Grey

    grid.SetGridLineColour(wx.Colour(195, 195, 195))
    def __init__(self, student):

        wx.Frame.__init__(self,
                          parent=None,
                          title="学生信息单",
                          pos=(100, 100),
                          size=(500, 500))

        self.panel = wx.Panel(self)
        studentMessage = student.getStudentMessage()

        wx.StaticText(self.panel, -1, studentMessage[0], pos=(50, 10))
        wx.StaticText(self.panel, -1, studentMessage[1], pos=(100, 10))

        gradeLabel = wx.StaticText(self.panel, -1, "学生成绩单", pos=(200, 10))
        gradeLabel.SetFont(wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL))

        wx.StaticText(self.panel,
                      -1,
                      "================================================",
                      pos=(50, 30))
        t = str(time.localtime(time.time()).tm_year)+\
            '.'+str(time.localtime(time.time()).tm_mon)+\
            '.'+str(time.localtime(time.time()).tm_mday)

        self.gradeLabel = wx.StaticText(self.panel, -1, t, pos=(400, 10))
        grid = wx.grid.Grid(self.panel, id=-1, pos=(50, 50), size=(400, 200))

        grid.CreateGrid(10, 5)
        grid.HideRowLabels()
        grid.HideColLabels()
        grid.SetColSize(0, 69)
        grid.SetColSize(1, 100)
        grid.SetColSize(2, 69)
        grid.SetGridLineColour(wx.Colour(230, 230, 230))
        grid.SetDefaultCellBackgroundColour(wx.Colour(230, 230, 230))
        grid.EnableEditing(False)
        classesGrade = student.getCompleteStudentGrade()
        grid.SetCellValue(0, 0, '课程号')
        grid.SetCellValue(0, 1, '课程名')
        grid.SetCellValue(0, 2, '成绩')
        grid.SetCellValue(0, 3, '学分')
        grid.SetCellValue(0, 4, '教师')
        avgGrade = 0
        for i in range(len(classesGrade)):
            for j in range(len(classesGrade[i])):
                grid.SetCellValue(i + 1, j, classesGrade[i][j])
            avgGrade += int(classesGrade[i][2])
        avgLabel = wx.StaticText(self.panel,
                                 -1,
                                 "平均成绩:" + str(avgGrade / len(classesGrade)),
                                 pos=(200, 300))
        avgLabel.SetFont(wx.Font(30, wx.ROMAN, wx.ITALIC, wx.NORMAL))
Exemple #7
0
 def init_grid(self):
     colLabels = ['日期', '类型', '金额(元)', '原因', '相关人员']
     self.grid_data = self.get_grid_data()
     print(self.grid_data)
     grid = Part.GenGrid(
         self, colLabels,
         {k: self.grid_data[k]
          for k in self.grid_data if k[1] != 5})
     grid.SetColSize(0, 175)
     grid.SetColSize(3, 200)
     grid.SetColSize(4, 200)
     grid.EnableEditing(False)
     return grid
Exemple #8
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)

        # Create a wxGrid object
        grid = wx.grid.Grid(self, -1)

        # Then we call CreateGrid to set the dimensions of the grid
        # (100 rows and 10 columns in this example)
        grid.CreateGrid(100, 10)

        # We can set the sizes of individual rows and columns
        # in pixels

        grid.SetColSize(5, 200)
        # And set grid cell contents as strings
        grid.SetCellValue(0, 0, 'wxGrid is good')

        # We can specify that some cells are read.only
        grid.SetCellValue(0, 3, 'This is read.only')
        grid.SetReadOnly(0, 3)

        # Colours can be specified for grid cell contents
        grid.SetCellValue(3, 3, 'green on grey')
        grid.SetCellTextColour(3, 3, wx.GREEN)
        grid.SetCellBackgroundColour(3, 3, wx.LIGHT_GREY)

        # We can specify the some cells will store numeric
        # values rather than strings. Here we set grid column 5
        # to hold floating point values displayed with width of 6
        # and precision of 2
        grid.SetColFormatFloat(5, 6, 2)
        grid.SetCellValue(0, 6, '3.1415')

        self.Show()
Exemple #9
0
    def _updateColAttrs(self, grid):
        """
        wx.Grid -> update the column attributes to add the
        appropriate renderer given the column name.  (renderers
        are stored in the self.plugins dictionary)

        Otherwise default to the default renderer.
        """
        col = 0

        for colname in self.colnames:
            attr = gridlib.GridCellAttr()
            if colname in self.plugins:
                renderer = self.plugins[colname](self)

                if renderer.colSize:
                    grid.SetColSize(col, renderer.colSize)

                if renderer.rowSize:
                    grid.SetDefaultRowSize(renderer.rowSize)

                attr.SetReadOnly(True)
                attr.SetRenderer(renderer)

            grid.SetColAttr(col, attr)
            col += 1
Exemple #10
0
        def __init__(self, parent):
            wx.Frame.__init__(self, parent)



            # create a wxGrid object
            grid = wx.grid.Grid(self, -1)
            grid.CreateGrid(100, 10)

            #setting sizes of individual rows and colums in pixels
            grid.SetRowSize(0, 60)
            grid.SetColSize(0, 120)

            #set grid contents as strings
            grid.SetCellValue(0,0,'wxgrid is good')

            #can specify cells as read-only
            grid.SetReadOnly(0,0)

            #colors for cell contents
            grid.SetCellValue(0,1,'color!')
            grid.SetCellTextColour(0,1,wx.LIGHT_GREY)

            #define the default cell text color
            grid.SetDefaultCellTextColour(wx.BLACK)

            self.Show()
Exemple #11
0
 def GenGrid(cls, parent, colLabels, data):
     table = GenericTable(data=data, colLabels=colLabels)
     grid = GridTable(parent, table)
     grid.SetColSize(0, 180)
     # grid.SetTable(table, True)
     # grid.SetDefaultRowSize(26)
     # grid.SetRowLabelSize(36)
     return grid
Exemple #12
0
 def set_grid_size(self, grid):
     grid.DisableDragRowSize()
     grid.DisableDragColSize()
     grid.SetColLabelValue(0, "NAME")
     grid.SetColLabelValue(1, "SCORE")
     for i in range(2):
         grid.SetRowSize(i, 30)
         grid.SetColSize(i, 120)
     grid.SetRowSize(2, 30)
Exemple #13
0
    def __init__(self,
                 parent,
                 id,
                 title,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE,
                 data=[],
                 head=[],
                 info=[]):
        wx.Frame.__init__(self, parent, id, title, pos, size, style)
        grid = wx.grid.Grid(self, -1)

        col = len(data[0])
        row = len(data)

        colnum = len(head)
        inforownum = len(info)

        collen = []
        for c in range(colnum):
            lmax = 0
            for item in data:
                l = len(str(item[c]))
                if lmax < l:
                    lmax = l
            l = len(str(head[c]))
            if lmax < l:
                lmax = l

            collen.append(lmax)

        grid.CreateGrid(row + inforownum, col)

        grid.SetRowSize(0, 30)
        for i, value in enumerate(collen):
            grid.SetColSize(i, value * 8 + 20)

        for i, item in enumerate(head):
            grid.SetColLabelValue(i, item)

        for irow, x in enumerate(data):
            for icol, item in enumerate(x):
                grid.SetCellValue(irow + inforownum, icol, str(item))
                grid.SetReadOnly(irow + inforownum, icol)

        #设置头信息格

        headstr = ''
        for item in info:
            headstr += item

        grid.SetCellSize(0, 0, inforownum, colnum)
        grid.SetCellValue(0, 0, headstr)

        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
    def _updateColAttrs(self, grid):
        """
        wx.grid.Grid -> update the column attributes to add the
        appropriate renderer given the column name.

        Otherwise default to the default renderer.
        """

        for col in range(self.GetNumberCols()):
            attr = wx.grid.GridCellAttr()
            attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
            grid.SetColAttr(col, attr)
            grid.SetColSize(col, self.ColSizes[col])

        for row in range(self.GetNumberRows()):
            row_highlights = self.Highlights.get(row, {})
            for col in range(self.GetNumberCols()):
                editor = None
                renderer = None
                colname = self.GetColLabelValue(col, False)
                grid.SetReadOnly(row, col, False)
                if colname == "Name":
                    editor = wx.grid.GridCellTextEditor()
                    renderer = wx.grid.GridCellStringRenderer()
                elif colname == "Interval":
                    editor = DurationCellEditor(self)
                    renderer = wx.grid.GridCellStringRenderer()
                    if self.GetValueByName(row, "Triggering") != "Cyclic":
                        grid.SetReadOnly(row, col, True)
                elif colname == "Single":
                    editor = wx.grid.GridCellChoiceEditor()
                    editor.SetParameters(self.Parent.VariableList)
                    if self.GetValueByName(row, "Triggering") != "Interrupt":
                        grid.SetReadOnly(row, col, True)
                elif colname == "Triggering":
                    editor = wx.grid.GridCellChoiceEditor()
                    editor.SetParameters(
                        ",".join([""] + map(_, GetTaskTriggeringOptions())))
                elif colname == "Type":
                    editor = wx.grid.GridCellChoiceEditor()
                    editor.SetParameters(self.Parent.TypeList)
                elif colname == "Priority":
                    editor = wx.grid.GridCellNumberEditor()
                    editor.SetParameters("0,65535")
                elif colname == "Task":
                    editor = wx.grid.GridCellChoiceEditor()
                    editor.SetParameters(self.Parent.TaskList)

                grid.SetCellEditor(row, col, editor)
                grid.SetCellRenderer(row, col, renderer)

                highlight_colours = row_highlights.get(
                    colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
                grid.SetCellBackgroundColour(row, col, highlight_colours[0])
                grid.SetCellTextColour(row, col, highlight_colours[1])
            self.ResizeRow(grid, row)
Exemple #15
0
    def __init__(self, parent):
        # Cria Formulario
        wx.Frame.__init__(self, parent, -1, "Google Chrome Password Recovery", size=(880, 350))
        panel = wx.Panel(self, wx.ID_ANY)
 
        # Cria Menu
        menu = wx.Menu()
        menu.Append(5000, "S&alvar")
        menu.Append(5001, "Sai&r")
 
        menu1 = wx.Menu()
        menu1.Append(6001, "&Sobre", "Informação sobre este programa")
 
        # Cria Barra de menus
        menubarra = wx.MenuBar()
        menubarra.Append(menu, "&Arquivo")
        menubarra.Append(menu1, "&Sobre")
        self.SetMenuBar(menubarra)
 
        # Barra de status
        statusbar = self.CreateStatusBar(5)
 
        # Retorna data
        dataA = datetime.datetime.today()
        dataA = dataA.strftime('%d-%b-%Y')
 
        # Set today date in the second field
        self.SetStatusText("Estação: " + os.environ['COMPUTERNAME'], 0)
        self.SetStatusText("Usuario: " + getpass.getuser(), 1)
        self.SetStatusText("Data Atual: " + dataA, 2)
        self.SetStatusText(self.plataforma(), 3)
        self.SetStatusText("Desenvolvimento Aberto - 2014", 4)
 
        # Declara Eventos dos menus
        self.Bind(wx.EVT_MENU, self.OnSalvar, id=5000)
        self.Bind(wx.EVT_MENU, self.OnSair, id=5001)
        self.Bind(wx.EVT_MENU, self.OnSobre, id=6001)
 
        # Cria Grid de dados
        grid = SimpleGrid(panel)
        grid.SetColSize(0, 430)
        grid.SetColSize(1, 230)
        grid.SetColSize(2, 108)
Exemple #16
0
    def createTable(self):

        grid = wx.grid.Grid(self, -1)

        grid.createGrid(100, 10)

        grid.SetRowSize(0, 60)
        grid.SetColSize(0, 120)

        grid.SetCellValue(0, 0, 'wxGrid is good')
Exemple #17
0
 def __init__(self):
     wx.Frame.__init__(self, None, title="Grid Sizes", size=(600, 300))
     grid = wx.grid.Grid(self)
     grid.CreateGrid(5, 5)
     for row in range(5):
         for col in range(5):
             grid.SetCellValue(row, col, "(%s,%s)" % (row, col))
     grid.SetCellSize(2, 2, 2, 3)
     grid.SetColSize(1, 125)
     grid.SetRowSize(1, 100)
Exemple #18
0
    def OnOpenLogcatClicked(self, event):
        self.open_logcat.Enable(False)
        self.close_logcat.Enable(True)

        # 加载数据库
        self.loadDataBase(
            2)  # 用一个列表返回数据库 不要赋值给self (data = xx.loadDataBase() )
        # 必须要变宽才能显示 scroll
        self.SetSize(980, 560)
        grid = wx.grid.Grid(self, pos=(320, 0), size=(640, 500))
        # 行数列数
        grid.CreateGrid(100, 4)
        # 画水平与垂直线
        for i in range(100):
            for j in range(4):
                grid.SetCellAlignment(i, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        # name of first row
        grid.SetColLabelValue(0, "工号")
        grid.SetColLabelValue(1, "姓名")
        grid.SetColLabelValue(2, "打卡时间")
        grid.SetColLabelValue(3, "是否迟到")
        # Size of each col
        grid.SetColSize(0, 120)
        grid.SetColSize(1, 120)
        grid.SetColSize(2, 150)
        grid.SetColSize(3, 150)

        grid.SetCellTextColour(wx.BLUE)
        for i, id in enumerate(self.logcat_id):
            grid.SetCellValue(i, 0, str(id))
            grid.SetCellValue(i, 1, self.logcat_name[i])
            grid.SetCellValue(i, 2, self.logcat_datetime[i])
            grid.SetCellValue(i, 3, self.logcat_late[i])

            grid.SetCellTextColour(
                i, 3, wx.RED
            ) if self.logcat_late[i] == '是' else grid.SetCellTextColour(
                i, 3, wx.GREEN)
        # Not allowed to edit
        grid.EnableEditing(False)
        pass
 def buidUISizer(self):
     flagsR = wx.CENTER
     hsizer = wx.BoxSizer(wx.HORIZONTAL)
     for _ in range(3):
         vSizer = wx.BoxSizer(wx.VERTICAL)
         # Row idx = 0 : show the PLC name/type and the I/O usage.
         nameLb = wx.StaticText(self, label="PLC Name: ".ljust(15))
         self.nameLbList.append(nameLb)
         vSizer.Add(nameLb, flag=flagsR, border=2)
         vSizer.AddSpacer(10)
         gpioLbN = wx.StaticText(self, label="PLC I/O usage: ".ljust(15))
         vSizer.Add(gpioLbN, flag=flagsR, border=2)
         self.gpioLbList.append(gpioLbN)
         vSizer.AddSpacer(10)
         vSizer.Add(wx.StaticLine(self,
                                  wx.ID_ANY,
                                  size=(180, -1),
                                  style=wx.LI_HORIZONTAL),
                    flag=flagsR,
                    border=2)
         vSizer.AddSpacer(10)
         # Row idx =1 : show the PLC data.
         grid = wx.grid.Grid(self, -1)
         grid.CreateGrid(8, 4)
         grid.SetRowLabelSize(30)
         grid.SetColLabelSize(22)
         grid.SetColSize(0, 40)
         grid.SetColSize(1, 40)
         grid.SetColSize(2, 40)
         grid.SetColSize(3, 40)
         # Set the column label.
         grid.SetColLabelValue(0, 'IN')
         grid.SetColLabelValue(1, 'Val')
         grid.SetColLabelValue(2, 'OUT')
         grid.SetColLabelValue(3, 'Val')
         vSizer.Add(grid, flag=flagsR, border=2)
         self.gridList.append(grid)
         hsizer.Add(vSizer, flag=flagsR, border=2)
         hsizer.AddSpacer(5)
     return hsizer
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, size=wx.DefaultSize)

        pnl2 = wx.lib.scrolledpanel.ScrolledPanel(self,
                                                  3,
                                                  size=(1200, 500),
                                                  pos=(10, 10),
                                                  style=wx.SIMPLE_BORDER)
        pnl2.SetupScrolling()

        self.DueDateDatabase()
        self.sendsms()
        self.birthdaysms()

        conn = sqlite3.connect('MemberData.db')
        c = conn.cursor()
        c.execute('SELECT * FROM gym3')
        data = c.fetchall()
        conn.close()

        count = 0
        for i in data:
            count += 1

        grid = wx.grid.Grid(pnl2, -1)
        grid.CreateGrid(count, 8)

        grid.SetColSize(0, 120)
        grid.SetColSize(1, 200)
        grid.SetColSize(2, 150)
        grid.SetColSize(3, 150)
        grid.SetColSize(4, 120)
        grid.SetColSize(5, 120)
        grid.SetColSize(6, 150)

        grid.SetColLabelValue(0, "Enrollment No.")
        grid.SetColLabelValue(1, "Name")
        grid.SetColLabelValue(2, "Contact No.")
        grid.SetColLabelValue(3, "Residence No.")
        grid.SetColLabelValue(4, "Date of Joining")
        grid.SetColLabelValue(5, "Fee Paid")
        grid.SetColLabelValue(6, "Membership Time")
        grid.SetColLabelValue(7, "Status")

        z = -1
        for i in data:
            z += 1
            for j in range(0, 8):
                a = str(i[j])
                grid.SetCellValue(z, j, a)
                grid.SetReadOnly(z, j)

        gbox = wx.BoxSizer()
        gbox.Add(grid, 1, wx.EXPAND)
        pnl2.SetSizer(gbox)
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        font = wx.Font(wx.FONTSIZE_MEDIUM, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)

        lbl1 = wx.StaticText(self, -1, "Legacy* : ", pos=(50, 50))
        self.txt_lgy = wx.TextCtrl(self, id=wx.ID_ANY, pos=(140, 45), size=(200, 25))
        btn_chk1 = wx.Button(self, -1, label="Check", pos=(360, 45))

        lbl2 = wx.StaticText(self, -1, "Deflections : ", pos=(50, 100))
        self.txt_lgy = wx.TextCtrl(self, id=wx.ID_ANY, pos=(140, 90), size=(200, 25))
        btn_chk1 = wx.Button(self, -1, label="Check", pos=(360, 90))

        lbl3 = wx.StaticText(self, -1, "PLOTING AREA*", pos=(500, 45))
        lbl3.SetFont(font)
        vbox = wx.BoxSizer(wx.VERTICAL)
        plot_graph = wx.Panel(self, 1, name='PLOTING AREA*', pos=(500, 70), size=(650, 450))
        plot_graph.SetBackgroundColour('#ededed')
        vbox.Add(plot_graph, wx.ID_ANY, wx.EXPAND)
        plot_graph.SetSizer(vbox)

        lbl4 = wx.StaticText(self, -1, "Deflections ", pos=(50, 180))
        lbl4.SetFont(font)
        list_panel = wx.Panel(self, 1, name='Deflections', pos=(50, 200), size=(200, 200))
        list_panel.SetBackgroundColour('#ededed')
        lst = wx.ListBox(list_panel, 1, style=wx.LB_DEFAULT, name='Deflections', pos=(50, 200), size=(200, 200))

        btn_ppmeter = wx.Button(self, -1, label="Plot Parameters", pos=(270, 250))

        lbl5 = wx.StaticText(self, -1, 'Scaling Deflections*', pos=(50, 450))
        lbl5.SetFont(font)
        grid = wx.grid.Grid(self, 1, name='Scaling Deflections*', pos=(50, 475), size=(325, 110))
        grid.CreateGrid(4, 2)
        # grid.HideRowLabels()
        grid.SetColLabelValue(0, 'Stage')
        grid.SetColLabelValue(1, 'Scaling')
        grid.SetColSize(0, 120)
        grid.SetColSize(1, 120)
Exemple #22
0
    def __init__(self):
        wx.Frame.__init__(self, parent=None, title="成绩查询", size=(1050, 560))

        grid = wx.grid.Grid(self, pos=(10, 0), size=(1050, 500))
        grid.CreateGrid(100, 9)
        for i in range(100):
            for j in range(9):
                grid.SetCellAlignment(i, j, wx.ALIGN_CENTER, wx.ALIGN_CENTER)
        grid.SetColLabelValue(0, "序号")  #第一列标签
        grid.SetColLabelValue(1, "初修学期")
        grid.SetColLabelValue(2, "获得学期")
        grid.SetColLabelValue(3, "课程")
        grid.SetColLabelValue(4, "成绩")  # 第一列标签
        grid.SetColLabelValue(5, "学分")
        grid.SetColLabelValue(6, "课程属性")
        grid.SetColLabelValue(7, "课程性质")
        grid.SetColLabelValue(8, "获得方式")  # 第一列标签

        grid.SetColSize(0, 50)
        grid.SetColSize(1, 100)
        grid.SetColSize(2, 100)
        grid.SetColSize(3, 350)
        grid.SetColSize(4, 50)
        grid.SetColSize(5, 50)
        grid.SetColSize(6, 50)
        grid.SetColSize(7, 100)
        grid.SetColSize(8, 100)

        grid.SetCellTextColour("NAVY")
        data = csu.search()
        data.remove(data[0])
        print(data)
        for i, item1 in enumerate(data):
            for j, item2 in enumerate(item1):
                grid.SetCellValue(i, j, data[i][j])

        pass
Exemple #23
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)

        grid = wx.grid.Grid(self, -1)
        grid.CreateGrid(len(numandword), 3)
        grid.SetColSize(1, 90)
        grid.SetCellValue(0, 0, "Wort")
        grid.SetCellValue(0, 1, "Anzahl des Worts")
        grid.SetCellValue(0, 2, "Anteil am Text")

        for s in range(len(numandword)):
            for r in range(0, 3):
                if r == 0:
                    grid.SetCellValue(s, 0, str(numandword[s][0]))
                if r == 1:
                    grid.SetCellValue(s, 1, str(numandword[s][1]))
                if r == 2:
                    grid.SetCellValue(s, 2, str(numandword[s][2]))
        self.Show()
	def __init__(self):
		wx.Frame.__init__(self,parent=None,title="成绩查询",size=(900,560))


		grid = wx.grid.Grid(self,pos=(10,0),size=(750,500))
		grid.CreateGrid(20,7)
		for i in range(20):
			for j in range(7):
				grid.SetCellAlignment(i,j,wx.ALIGN_CENTER,wx.ALIGN_CENTER)
		grid.SetColLabelValue(0, "星期一")  #第一列标签
		grid.SetColLabelValue(1, "星期二")
		grid.SetColLabelValue(2, "星期三")
		grid.SetColLabelValue(3, "星期四")
		grid.SetColLabelValue(4, "星期五")  # 第一列标签
		grid.SetColLabelValue(5, "星期六")
		grid.SetColLabelValue(6, "星期日")

		grid.SetColSize(0,100)
		grid.SetColSize(1,100)
		grid.SetColSize(2,100)
		grid.SetColSize(3,100)
		grid.SetColSize(4,100)
		grid.SetColSize(5,100)
		grid.SetColSize(6,100)
		grid.SetRowSize(0, 90)
		grid.SetRowSize(1, 90)
		grid.SetRowSize(2, 90)
		grid.SetRowSize(3, 90)
		grid.SetRowSize(4, 90)

		grid.SetCellTextColour("NAVY")

		data = test.search()
		for i in range(5):
			for j in range(7):
				file_handle = open('txt/%s.txt'%(i*7+j), mode='w', encoding='utf8')
				grid.SetCellValue(i, j, data[i*7+j])
				file_handle.writelines(data[i*7+j]+"\n")
				file_handle.close()


		pass
Exemple #25
0
    def OnSize(self, evt):
        if self.GetAutoLayout():
            self.Layout()
        #github test
        # Then we call CreateGrid to set the dimensions of the grid
        # (10 rows and 7 columns)

        grid.CreateGrid(10, 7)
        my_date = date.today()
        index = my_date.weekday()
        for i in range(0, 7):
            if index == 7:
                index = 0
            grid.SetColLabelValue(i, calendar.day_name[index])
            index = index + 1
        time_label = 9
        for i in range(0, 10):
            grid.SetRowLabelValue(i, (str(time_label) + ":00"))
            time_label = time_label + 1
        # We can set the sizes of individual rows and columns
        # in pixels
        grid.SetRowSize(0, 60)
        grid.SetColSize(0, 120)

        # And set grid cell contents as strings
        grid.SetCellValue(0, 0, 'wxGrid is good')
        testString = "Hello"  #Read from xml file
        # We can specify that some cells are read.only
        grid.SetCellValue(0, 3, testString)
        grid.SetReadOnly(0, 3)

        # We can specify the some cells will store numeric
        # values rather than strings. Here we set grid column 5
        # to hold floating point values displayed with width of 6
        # and precision of 2
        grid.SetColFormatFloat(5, 6, 2)
        grid.SetCellValue(0, 6, '3.1415')

        self.Show()
    def __init__(self, parent, id, G):
        wx.Frame.__init__(self, parent, id, 'Breadboard', size=(1194, 250))
        grid = wx.grid.Grid(self)
        grid.CreateGrid(10, 64)
        grid.SetRowLabelSize(22)
        grid.SetColMinimalAcceptableWidth(10)
        for row in range(10):
            t1 = chr(row + 97)
            grid.SetRowLabelValue(row, t1)
            for col in range(64):
                t2 = str(col + 1)
                t = t1 + t2
                grid.SetColLabelValue(col, t2)
                grid.SetColSize(col, 18)
                grid.SetCellValue(row, col, t)
                grid.SetCellBackgroundColour(row, col, wx.CYAN)
                grid.SetReadOnly(row, col, isReadOnly=True)
        print "Right click where you want to start."

        grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnCellLeftClick)

        print G
Exemple #27
0
    def init_grid(self):
        colLabels = [
            '人员', self.fund_kind['01'] + '(元)', self.fund_kind['02'] + '(元)',
            self.fund_kind['03'] + '(元)', self.fund_kind['04'] + '(元)', '总计(元)'
        ]
        self.grid_data = self.get_grid_data()
        grid = Part.GenGrid(self, colLabels, self.get_grid_data())
        grid.EnableEditing(False)
        # grid.SetDefaultCellOverflow(False)

        grid.SetColSize(0, 110)
        grid.SetColSize(1, 125)
        grid.SetColSize(2, 125)
        grid.SetColSize(3, 125)
        grid.SetColSize(4, 125)
        grid.SetColSize(5, 125)
        return grid
Exemple #28
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        self.create_widgets()
        # Create a wxGrid object
        grid = wx.grid.Grid(self, -1)
        gridPanel = wx.Panel(self, 43, wx.DefaultPosition, wx.Size(300, 200))
        vbox = wx.BoxSizer()
        vbox.Add(grid, 0, wx.ALIGN_CENTER)
        vbox.Add(self.einlese_Button, 0, wx.BOTTOM)
        gridPanel.SetSizer(vbox)
        # Then we call CreateGrid to set the dimensions of the grid
        # (100 rows and 10 columns in this example)
        grid.CreateGrid(20, 10)

        # We can set the sizes of individual rows and columns
        # in pixels
        grid.SetRowSize(0, 60)
        grid.SetColSize(0, 120)

        # And set grid cell contents as strings
        grid.SetCellValue(0, 0, 'wxGrid is good')

        # We can specify that some cells are read.only
        grid.SetCellValue(0, 3, 'This is read.only')
        grid.SetReadOnly(0, 3)

        # Colours can be specified for grid cell contents
        grid.SetCellValue(3, 3, 'green on grey')
        grid.SetCellTextColour(3, 3, wx.GREEN)
        grid.SetCellBackgroundColour(3, 3, wx.LIGHT_GREY)

        # We can specify the some cells will store numeric
        # values rather than strings. Here we set grid column 5
        # to hold floating point values displayed with width of 6
        # and precision of 2
        grid.SetColFormatFloat(5, 6, 2)
        grid.SetCellValue(0, 6, '3.1415')
        self.Show()
 def getBranchesInArea(self, event):
     AreaClicked = event.GetString()
     branchesInAreaDF = self.__mutualMet.getAllBranchesInArea(
         self.__city.GetValue(), AreaClicked)
     branchesFrame = wx.Frame(None,
                              -1,
                              title="branches in area: " + AreaClicked,
                              size=(500, 300))
     grid = wx.grid.Grid(branchesFrame, -1)
     numOfColumns = branchesInAreaDF.shape[1]
     numOfRows = branchesInAreaDF.shape[0]
     grid.CreateGrid(numOfRows,
                     numOfColumns)  #set the dimensions of the grid
     grid.SetColLabelValue(0, "Chain Name")
     grid.SetColLabelValue(1, "Branch Name")
     for rowNum in range(numOfRows):
         for colNum in range(numOfColumns):
             grid.SetRowSize(rowNum, 50)
             grid.SetColSize(colNum, 200)
             cellString = branchesInAreaDF.iloc[rowNum][colNum].decode(
                 'cp1255', 'strict')
             grid.SetCellValue(rowNum, colNum, cellString)
             grid.SetReadOnly(rowNum, colNum)
     branchesFrame.Show()
Exemple #30
0
 def CreateGrid(self, parent):
     # pp = wx.Panel(parent)
     # grid = wx.grid.Grid(pp)
     grid = wx.grid.Grid(parent)
     grid.CreateGrid(len(data), len(data[0]))
     grid.SetColSize(0, 70)
     grid.SetColSize(1, 110)
     grid.SetColSize(2, 70)
     grid.SetColSize(3, 110)
     grid.SetColSize(4, 110)
     grid.SetColSize(5, 110)
     grid.SetColMinimalAcceptableWidth(80)
     grid.SetRowMinimalAcceptableHeight(50)
     for r in range(len(data)):
         grid.SetRowSize(r, 50)
         for c in range(len(data[r])):
             # grid.SetColLabelValue(c, column_names[c])
             grid.SetCellValue(r, c, str(data[r][c]))
             grid.SetCellAlignment(r, c, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)
             font = wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False)
             grid.SetCellFont(r, c, font)
     grid.AutoSize()
     # pp.SetSizer(grid)
     return grid