LedgerGridDemo 项目分析¶
项目信息¶
- 项目名称: LedgerGridDemo
- 下载链接: LedgerGridDemo.rar
- 分析时间: 2026-03-05
文件结构¶
LedgerGridDemo/
├── Extractor_Icon.ico
├── Project1.py
├── Project1.xml
├── Unit1.py
├── Unit1.pydfm
├── Unit1.sct
├── Unit1.sfm
主程序文件: Project1.py¶
from glcl import *
from Unit1 import *
def main():
Application.Initialize()
Application.Title = 'Project1'
Application.MainFormOnTaskbar = True
Application.Icon.LoadFromFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Extractor_Icon.ico"))
MainForm = Form1(Application)
MainForm.Show()
FreeConsole()
Application.Run()
MainForm.Free()
if __name__ == '__main__':
main()
单元文件: Unit1.py¶
# Powered By Python Studio, The best Python GUI IDE to download from glsite.com.
import os
from glcl import *
class Form1(Form):
def __init__(self, owner):
self.LedgerGrid1 = LedgerGrid(self)
self.LoadProps(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Unit1.pydfm"))
self.LedgerGrid1.OnSelectCell = self.LedgerGrid1SelectCell
self.LedgerGrid1.OnGetEditText = self.LedgerGrid1GetEditText
# 此控件使用比较简单,一般用于会计、记账
def LedgerGrid1GetEditText(self, Sender, ACol, ARow, Value):
print(Value)
def LedgerGrid1SelectCell(self, Sender, ACol, ARow, CanSelect):
print(CanSelect)
设计文件: Unit1.sct¶
def LedgerGrid1GetEditText(Sender, ACol, ARow, Value):
def LedgerGrid1SelectCell(Sender, ACol, ARow, CanSelect):
设计文件: Unit1.sfm¶
object Form1: TForm
Left = 0
Top = 0
Caption = 'LedgerGrid'
ClientHeight = 186
ClientWidth = 628
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Segoe UI'
Font.Style = []
TextHeight = 20
object LedgerGrid1: TLedgerGrid
Left = 8
Top = 8
Width = 606
Height = 170
DefaultRowHeight = 20
DrawingStyle = gdsClassic
FixedCols = 0
RowCount = 7
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goTabs, goFixedRowDefAlign]
ScrollBars = ssNone
TabOrder = 0
OnGetEditText = LedgerGrid1GetEditText
OnSelectCell = LedgerGrid1SelectCell
DigitalNumber = 8
AutoSize = False
Version = '1.0'
ColWidths = (
180
120
120
90
90)
RowHeights = (
40
20
20
20
20
20
20)
end
end
其他文件¶
- Extractor_Icon.ico
- Project1.xml
详细分析¶
功能概述¶
网格组件演示
使用的组件¶
- Form1 (TForm)
- LedgerGrid1 (TLedgerGrid)
技术特点¶
- 包含2个GUI组件
- 定义0个事件处理
窗体属性¶
- caption: LedgerGrid
- height: 186
- width: 628
代码分析¶
导入的模块: - import os - from glcl import *
定义的类: - Form1
定义的方法: - init - LedgerGrid1GetEditText - LedgerGrid1SelectCell