How to use _setter method in pypom_form

Best Python code snippet using pypom_form_python

printer.py

Source:printer.py Github

copy

Full Screen

1# -*- encoding = utf-8 -*-2# @Time : 2022-08-04 21:553# @Author : Levitan4# @File : printer.py5# @Software : PyCharm6import abc7from math import ceil8from .setter import *9from . import color10# 抽象打印器类11class AbstractPrinter(abc.ABC):12 def __init__(self):13 self._setter: AbstractSetter = None # 保存打印器的配置器14 # 设置打印器的配置器15 @abc.abstractmethod16 def setSetter(self, setter: AbstractSetter):17 pass18 # 判断打印器的设置器是否为空19 # 如果设置器不为空则什么都不做,如果为空则创建一个默认的设置器20 # 具体打印器需要什么设置器又子类实现21 @abc.abstractmethod22 def _isSetterNone(self):23 pass24 # 将传入的数据进行预处理25 @abc.abstractmethod26 def _preprocessing(self, data):27 pass28 # 将数据输出29 @abc.abstractmethod30 def _printOut(self, data):31 pass32 # 重置属性33 @abc.abstractmethod34 def _resetProperties(self):35 pass36 # 每个打印器的入口37 # 该方法规定了打印器中方法调用的顺序38 def print(self, data=None):39 self._isSetterNone()40 data = self._preprocessing(data)41 self._printOut(data)42 self._resetProperties()43 # 获取字符的显示宽度44 @staticmethod45 def _getCharWidth(char):46 o = ord(char)47 widths = [48 (126, 1), (159, 0), (687, 1), (710, 0), (711, 1),49 (727, 0), (733, 1), (879, 0), (1154, 1), (1161, 0),50 (4347, 1), (4447, 2), (7467, 1), (7521, 0), (8369, 1),51 (8426, 0), (9000, 1), (9002, 2), (11021, 1), (12350, 2),52 (12351, 1), (12438, 2), (12442, 0), (19893, 2), (19967, 1),53 (55203, 2), (63743, 1), (64106, 2), (65039, 1), (65059, 0),54 (65131, 2), (65279, 1), (65376, 2), (65500, 1), (65510, 2),55 (120831, 1), (262141, 2), (1114109, 1),56 ]57 if o == 0xe or o == 0xf:58 return 059 for num, wid in widths:60 if o <= num:61 return wid62 return 163 # 获取字符串的显示宽度64 def _getStringWidth(self, string):65 width = 066 for char in string:67 width += self._getCharWidth(char)68 return width69# 表格打印器70class TablePrinter(AbstractPrinter):71 # 默认单元格宽度72 _defaultGridWidth = 573 def __init__(self) -> None:74 super().__init__()75 self._tableColumnWidth = [] # 表格中每列的宽度76 self._dataWidths: list[list]77 self._line: str78 self._xMax: int79 self._yMax: int80 self._head: list81 self._headWidths: list82 def setSetter(self, setter: TableSetter):83 self._setter = setter84 def _isSetterNone(self):85 if self._setter is not None:86 return87 self._setter = TableSetter()88 def _preprocessing(self, dataList):89 """90 将数据标准化91 """92 # 获取数据中的最大行的元素个数93 standardKey = 0 # 用于标记数据是否是标准的,大于一表示不标准94 maxRowLength = 0 # 保存数据中元素最多的行的元素个数95 for row in dataList:96 rowLength = len(row)97 if rowLength > maxRowLength:98 maxRowLength = rowLength99 if rowLength != maxRowLength:100 standardKey += 1101 if standardKey > 1:102 # 补全数据103 for index in range(len(dataList)):104 differ = maxRowLength - len(dataList[index])105 dataList[index] += ["" for _ in range(differ)]106 """107 向数据中添加序号,这一步之后表格的长宽就不会变了108 """109 if self._setter.autoOrdNumber:110 starNumber = self._setter.ordNumberStart111 step = self._setter.ordNumberStep112 title = self._setter.ordNumberName113 hasHead = self._setter.hasHead114 # 添加字段名115 start: int # 开始添加位置116 if hasHead:117 start = 1118 dataList[0].insert(0, title)119 else:120 start = 0121 for i in range(start, len(dataList)):122 dataList[i].insert(0, starNumber)123 starNumber += step124 if not self._setter.isAutoColumnWidth():125 shapeList = self._tableColumnWidth126 numberWidth = self._getStringWidth(str(starNumber))127 if numberWidth <= 5:128 shapeList.insert(0, 5)129 else:130 shapeList.insert(0, numberWidth)131 self._tableColumnWidth = shapeList132 self._xMax = len(dataList[0])133 self._yMax = len(dataList)134 """135 讲超过将超过用户指定长度的数据改为省略显示136 """137 widths = [[0 for _ in range(self._xMax)] for _ in range(self._yMax)]138 tableWidths = [0 for _ in range(self._xMax)]139 # 按列进行扫描140 for x in range(self._xMax):141 for y in range(self._yMax):142 dataList[y][x] = str(dataList[y][x]) # 将所有数据都转为字符串形143 if self._setter.isAutoColumnWidth():144 # 自动生成表格形状145 widths[y][x] = self._getStringWidth(dataList[y][x])146 if widths[y][x] > tableWidths[x]:147 tableWidths[x] = widths[y][x]148 else:149 # 进行省略显示操作150 if self._getStringWidth(dataList[y][x]) > self._tableColumnWidth[x]:151 strItem = dataList[y][x]152 while self._getStringWidth(strItem) + 3 > self._tableColumnWidth[x]:153 strItem = strItem[:len(strItem) // 2]154 dataList[y][x] = strItem + "..."155 widths[y][x] = self._getStringWidth(dataList[y][x])156 self._dataWidths = widths157 if self._setter.isAutoColumnWidth():158 self._tableColumnWidth = tableWidths159 """160 如果有表头就将表头提取出来161 """162 if self._setter.hasHead:163 self._head = dataList[0]164 self._headWidths = self._dataWidths[0]165 dataList = dataList[1:]166 self._dataWidths = self._dataWidths[1:]167 self._yMax -= 1168 self._createLine()169 return dataList170 # 打印表格171 def _printOut(self, dataList):172 # 获取配置信息173 splitChar = self._setter.splitChar174 tableShap = self._tableColumnWidth175 margin_left = self._setter.margin_left176 margin_right = self._setter.margin_right177 abreastTableNumber = self._setter.abreastTableNumber178 tableSplitChar = " " * self._setter.tableSplitWidth179 hasHead = self._setter.hasHead180 step = ceil(self._yMax / abreastTableNumber) # 计算不步长181 tables = []182 # 需要显示的表格数将数据切片保存到 tables 中183 for i in range(step):184 item = dataList[i::step]185 # 判断数据是否够186 # 如果不够则补充空数据,并且在_dataWidths中添加上对应数据位置的宽度187 if len(item) < abreastTableNumber:188 for n in range(abreastTableNumber - len(item)):189 item.append(["" for _ in range(self._xMax)])190 self._dataWidths.append([0 for _ in range(self._xMax)])191 tables.append(item)192 headColor = self._setter.headColor193 bodyColor = self._setter.bodyColor194 try:195 headColorize = getattr(color, headColor)196 bodyColorize = getattr(color, bodyColor)197 except AttributeError:198 raise Exception("传入的颜色参数错误,color.py中没有名为 {} 或 {} 的函数".format(headColor, bodyColor))199 # 打印表头200 if hasHead:201 heads = []202 for t in range(abreastTableNumber):203 head = splitChar204 for cIndex in range(len(self._head)):205 if self._setter.alignment in "lL":206 spaceBefore = " " * margin_left207 spaceAfter = " " * (tableShap[cIndex] - self._headWidths[cIndex] + margin_right)208 elif self._setter.alignment in "rR":209 spaceBefore = " " * (tableShap[cIndex] - self._headWidths[cIndex] + margin_left)210 spaceAfter = " " * margin_right211 elif self._setter.alignment in "cC":212 spaceCount = tableShap[cIndex] - self._headWidths[cIndex]213 start = spaceCount // 2214 end = spaceCount - start215 spaceBefore = " " * (start + margin_left)216 spaceAfter = " " * (end + margin_right)217 else:218 raise Exception("配置的表格对齐方式'{}'是错误的".format(self._setter.alignment))219 head += spaceBefore + self._head[cIndex] + spaceAfter + splitChar220 heads.append(head)221 print(headColorize(self._line))222 print(headColorize(tableSplitChar.join(heads)))223 # 打印表格主体224 for rIndex in range(len(tables)):225 rowList = []226 for tIndex in range(len(tables[rIndex])):227 row = splitChar228 for cIndex in range(len(tables[rIndex][tIndex])):229 if self._setter.alignment in "lL":230 spaceBefore = " " * margin_left231 spaceAfter = " " * (tableShap[cIndex] - self._dataWidths[tIndex * step + rIndex][cIndex] + margin_right)232 elif self._setter.alignment in "rR":233 spaceBefore = " " * (tableShap[cIndex] - self._dataWidths[tIndex * step + rIndex][cIndex] + margin_left)234 spaceAfter = " " * margin_right235 elif self._setter.alignment in "cC":236 spaceCount = tableShap[cIndex] - self._dataWidths[tIndex * step + rIndex][cIndex]237 start = spaceCount // 2238 end = spaceCount - start239 spaceBefore = " " * (start + margin_left)240 spaceAfter = " " * (end + margin_right)241 else:242 raise Exception("配置的表格对齐方式'{}'是错误的".format(self._setter.alignment))243 row += spaceBefore + tables[rIndex][tIndex][cIndex] + spaceAfter + splitChar244 # 加上表格之间的分割符245 rowList.append(row)246 print(bodyColorize(self._line))247 print(bodyColorize(tableSplitChar.join(rowList)))248 print(bodyColorize(self._line))249 def _resetProperties(self):250 self._tableColumnWidth.clear()251 self._dataWidths.clear()252 self._line = None253 self._xMax = None254 self._yMax = None255 self._head = None256 self._headWidths = None257 # 手动设置表格单元格的宽度258 def setTableColWidth(self, tableColWidth):259 # 检测出入参数是否符合标准260 for i in range(len(tableColWidth)):261 if tableColWidth[i] < 3:262 raise Exception("表格列宽中的的元素的值不能小于3,当前{}个元素的值为{}".format(i + 1, tableColWidth[i]))263 self._tableColumnWidth = tableColWidth264 self._setter.autoColumnWidth = False265 # 生成表格的边框线266 def _createLine(self):267 # 获取配置信息268 turnChar = self._setter.turnChar269 borderChar = self._setter.borderChar270 margin_left = self._setter.margin_left271 margin_right = self._setter.margin_right272 tableSplitChar = self._setter.tableSplitWidth * " "273 abreastTableNumber = self._setter.abreastTableNumber274 row = []275 for tIndex in range(abreastTableNumber):276 line = turnChar277 for i in self._tableColumnWidth:278 line += borderChar * (i + margin_left + margin_right) + turnChar279 row.append(line)280 self._line = tableSplitChar.join(row)281# 消息打印器282class MsgPrinter(AbstractPrinter):283 def __init__(self):284 super().__init__()285 self._maxSize = 0286 self._msgWidths = []287 def setSetter(self, setter: MsgSetter):288 self._setter = setter289 def _isSetterNone(self):290 if self._setter is not None:291 return292 self._setter = MsgSetter()293 def _preprocessing(self, msg: str) -> list:294 msgList = msg.split("\n")295 for i in msgList:296 size = super()._getStringWidth(i)297 self._msgWidths.append(size)298 if size > self._maxSize:299 self._maxSize = size300 return msgList301 def _printOut(self, msgList: list):302 horizontalSymbol = self._setter.horizontalSymbol303 verticalSymbol = self._setter.verticalSymbol304 marginLeft = self._setter.margin_left305 marginRight = self._setter.margin_right306 colorType = self._setter.color307 try:308 colorize = getattr(color, colorType)309 except AttributeError:310 raise Exception("传入的颜色参数错误,color.py中没有名为 {} 的函数".format(colorType))311 line = horizontalSymbol * (marginLeft + self._maxSize + marginRight + 2)312 print(colorize(line))313 for index in range(len(msgList)):314 front = verticalSymbol + " " * marginLeft315 behind = " " * (self._maxSize - self._msgWidths[index] + marginRight) + verticalSymbol316 print(colorize(front + msgList[index] + behind))317 print(colorize(line))318 def _resetProperties(self):319 self._maxSize = 0320 self._msgWidths.clear()321class SplitPrinter(AbstractPrinter):322 def __init__(self):323 super().__init__()324 def setSetter(self, setter: SplitSetter):325 self._setter = setter326 def _isSetterNone(self):327 if self._setter is not None:328 return329 self._setter = SplitSetter()330 def _preprocessing(self, data):331 return data332 def _printOut(self, length):333 length = self._setter.length334 symbol = self._setter.symbol335 colorType = self._setter.color336 frontNewlineNumber = self._setter.frontNewlineNumber337 behindNewlineNumber = self._setter.behindNewlineNumber338 message = self._setter.message339 lSymbol = self._setter.leftmostSymbol340 rSymbol = self._setter.rightmostSymbol341 try:342 colorize = getattr(color, colorType)343 except AttributeError:344 raise Exception("传入的颜色参数错误,color.py中没有名为 {} 的函数".format(colorType))345 bNumber = length // 2346 aNumber = length - bNumber347 line = "\n"*frontNewlineNumber + lSymbol + symbol*bNumber + message + symbol*aNumber + rSymbol + "\n"*behindNewlineNumber348 print(colorize(line))349 def _resetProperties(self):...

Full Screen

Full Screen

enums.py

Source:enums.py Github

copy

Full Screen

...5PORTAL_SERVICES_PATTERN = 'http*://*/sharing/servers/*/rest/services/*'6VERSION = '1.1'7PACKAGE_NAME = 'restapi'8USER_AGENT = '{} (Python)'.format(PACKAGE_NAME)9def _setter(lst=[]):10 if isinstance(lst, dict):11 return munchify(lst)12 d = {}13 if isinstance(lst, list):14 for i in lst:15 if isinstance(i, dict):16 for k,v in six.iteritems(i):17 d[k] = v18 elif isinstance(i, six.string_types):19 d[i] = i20 return munchify(d)21geometry = _setter([22 {23 'type': 'geometryType',24 'precision': 'geometryPrecision',25 'polygon': 'esriGeometryPolygon',26 'point': 'esriGeometryPoint',27 'polyline': 'esriGeometryPolyline',28 'multipoint': 'esriGeometryMultipoint',29 'envelope': 'esriGeometryEnvelope',30 'extent': _setter([31 'xmax',32 'ymax',33 'xmin',34 'ymin',35 {36 'initial': 'initialExtent',37 'full': 'fullExtent'38 }39 ])40 }, {41 'relationships': {42 'intersect': 'esriSpatialRelIntersects',43 'contains': 'esriSpatialRelContains',44 'crosses': 'esriSpatialRelCrosses',45 'envelopeIntersects': 'esriSpatialRelEnvelopeIntersects',46 'overlaps': 'esriSpatialRelOverlaps',47 'touches': 'esriSpatialRelTouches',48 'within': 'esriSpatialRelWithin',49 'relation': 'esriSpatialRelRelation'50 }51 },52 'null',53 'spatialReference',54 'rings',55 'paths',56 'points',57 'curveRings',58 'curvePaths',59 'x',60 'y',61])62admin = _setter([63 'user',64 'adminUrl',65 'permission',66 'permissions',67 'esriEveryone',68 'isAllowed',69 'principal',70 'privilege',71 'rolename',72 'roles',73 'users',74 'addToDefinition',75 'deleteFromDefinition',76 'updateDefinition',77])78agol = _setter([79 {80 'urls': {81 'base': 'www.arcgis.com',82 'sharingRest': 'https://www.arcgis.com/sharing/rest',83 'tokenService': 'https://www.arcgis.com/sharing/rest/generateToken',84 'self': 'https://www.arcgis.com/sharing/portals/self',85 'orgMaps': '.maps.arcgis.com'86 }87 },88 'isAgol',89 'isPortal',90 'isAdmin',91 'portalUser',92 'fullName',93 'user',94 'urlKey',95])96spatialReference = _setter([97 'spatialReference',98 'wkid',99 'wkt'100])101service = _setter([102 'extent',103 'initialExtent',104 'fullExtent',105 'spatialReference',106 'supportsTruncate',107 'truncate'108])109# geometryLookup = munchify({v: k for k,v in six.iteritems(geometry) if k})110fields = _setter([111 {112 'oid': 'esriFieldTypeOID',113 'shape': 'esriFieldTypeGeometry',114 'globalId': 'esriFieldTypeGlobalID',115 'text': 'esriFieldTypeString',116 'string': 'esriFieldTypeString', #alias117 'date': 'esriFieldTypeDate',118 'float': 'esriFieldTypeSingle',119 'double': 'esriFieldTypeDouble',120 'short': 'esriFieldTypeSmallInteger',121 'long': 'esriFieldTypeInteger',122 'guid': 'esriFieldTypeGUID',123 'raster': 'esriFieldTypeRaster',124 'blob': 'esriFieldTypeBlob',125 'sql': 'sqlType',126 'sqlOther': 'sqlTypeOther',127 'shapeToken': 'SHAPE@',128 'oidToken': 'OID@',129 'oidField': 'objectIdFieldName',130 'globalId': 'globalIdFieldName',131 }, {132 'lookup': {133 'esriFieldTypeDate': 'DATE',134 'esriFieldTypeString': 'TEXT',135 'esriFieldTypeSingle': 'FLOAT',136 'esriFieldTypeDouble': 'DOUBLE',137 'esriFieldTypeSmallInteger': 'SHORT',138 'esriFieldTypeInteger': 'LONG'139 },140 'skip': {141 'esriFieldTypeRaster': 'RASTER',142 'esriFieldTypeBlob': 'BLOB'143 }144 },145 'nullable',146 'editable',147 'length',148 'domain',149])150domain = _setter([151 'codedValues',152 'code',153 'range',154 {155 'codedUpper': 'CODED',156 'rangeUpper': 'RANGE'157 }158])159headers = _setter(160 { 'referer': 'Referer' },161)162cookies = _setter([163 'agstoken'164])165operations = _setter([166 'exportImage'167])168featureSet = _setter([169 'geometry',170 'attributes',171 'displayFieldName',172 'fieldAliases',173 'fields'174])175formats = _setter([176 'json',177 'pjson',178 'geojson',179 'sqlite',180 'kmz',181 'tiff',182 'esriJSON',183 'geoJSON',184])185serviceInfo = _setter([186 'tables',187 'layers',188 'layerDefs',189 'subLayerIds'190])191geocoding = _setter([192 'location',193 'locations',194 'singleLine',195 'langCode',196 'sourceCounty',197 'addresses',198 'numOfResults',199 'candidates',200 'score',201 'address'202])203types = _setter({204 'featureCollection': 'FeatureCollection',205 'featureLayer': 'FeatureLayer',206 'table': 'Table',207 'layer': 'Layer',208})209gpService = _setter([210 {'operations': _setter([211 'submitJob',212 'execute'213 ])},214 'esriExecutionTypeSynchronous',215 'esriExecutionTypeAsynchronous'216])217service = _setter([218 'supportsCalculate',219])220params = _setter([221 'f',222 'json',223 'pjson',224 'username',225 'client',226 'expiration',227 'token',228 'fields',229 'inSR',230 'outSR',231 'where',232 'time',233 'objectIds',234 'outFields',235 'geometry',236 'geometries',237 'units',238 'adds',239 'updates',240 'deletes',241 'bboxSR',242 'bbox',243 'bufferSR',244 'size',245 'format',246 'dpi',247 'unionResults',248 'currentVersion',249 'dataFormat',250 'relationParam',251 'maxRecordCount',252 'returnZ',253 'returnM',254 'returnTrueCurves',255 'returnIdsOnly',256 'resultRecordCount'257 'returnAttachments',258 'hasAttachments',259 'attachmentIds',260 'attachmentId',261 'definitionExpression',262 'supportsApplyEditsWithGlobalIds',263 'returnAttachmentsDataByUrl',264 'returnCatalogItems',265 'rollbackOnFailure',266 'useGlobalIds',267 'async',268 'syncModel',269 'unit',270 'distanceUnit',271 'distances',272 'transformation',273 'transformForward',274 'geodesic',275 'transportType',276 'category',277 'extentOfInterest'278])279response = _setter([280 'summary',281 'results',282 'attachment',283 'attachments',284 'attachmentInfos',285 'statusUrl',286 'success',287 'status',288 'error',289 'message',290 'globalIdField',291 'objectIdField',292 'parentGlobalId'293 'failedOIDs',294 'prototype',295 'templates',296 'description',297 'sqlite',298 'records',299 'addAttachmentResult',300 'addResults',301 'updateResults',302 'deleteResults',303 'addAttachmentResult',304 'updateAttachmentResult',305 'deleteAttachmentResults',306 'relatedRecordGroups',307 'relationships',308 'relatedRecords',309 'relationshipId',310 'updloadId',311 'contentType',312 'data',313 'location',314 'locations'315])316raster = _setter([317 'adjustAspectRatio',318 'noData',319 'noDataInterpretation',320 'esriNoDataMatchAll',321 'esriNoDataMatchAny',322 'mosaicRule',323 'renderingRule',324 'interpolation',325 'compression',326 'compressionQuality',327 'bandIds',328 'size',329 'imageSR',330 'transparent',331 {332 'bilinearInterpolation': 'RSP_BilinearInterpolation',333 'operations': {334 'plus': 1,335 'minus': 2,336 'multiply': 3,337 'clipInside': 1,338 'clipOutside': 2339 }340 }341])342misc = _setter([343 'crs',344 'urlWithToken',345 'proxy'346])347editing = _setter([348 {349 'info': 'editingInfo' ,350 'trackingInfo': 'editorTrackingInfo',351 'changeTracking': 'ChangeTracking'352 },353 'lastEditDate',354])355auth = _setter([356 'username',357 'password',358 'client',359 'expiration',360 'expires',361 'token',362 'referer',363 # spelling confusion alias364 {365 'referrer': 'referer',366 'info': 'authInfo'367 },368 'requestip',369 'tokenServicesUrl',...

Full Screen

Full Screen

build_calculator_view.py

Source:build_calculator_view.py Github

copy

Full Screen

1from tkinter import ttk, constants234class Builder:5 def __init__(self, frame, handle_home, setter, expression):6 self._frame = frame7 self._handle_home = handle_home8 self.equ = expression9 self._setter = setter1011 def _expression(self):12 expression = ttk.Label(13 master=self._frame,14 textvariable=self.equ,15 background="white"16 )17 expression.grid(columnspan=6, ipadx=100, sticky=constants.W)1819 def _numbers(self):20 num_1 = ttk.Button(21 master=self._frame,22 text="1",23 command=lambda: self._setter.set_press(1)24 )25 num_1.grid(row=1, column=0)26 num_2 = ttk.Button(27 master=self._frame,28 text="2",29 command=lambda: self._setter.set_press(2)30 )31 num_2.grid(row=1, column=1)32 num_3 = ttk.Button(33 master=self._frame,34 text="3",35 command=lambda: self._setter.set_press(3)36 )37 num_3.grid(row=1, column=2)38 num_4 = ttk.Button(39 master=self._frame,40 text="4",41 command=lambda: self._setter.set_press(4)42 )43 num_4.grid(row=1, column=3)44 num_5 = ttk.Button(45 master=self._frame,46 text="5",47 command=lambda: self._setter.set_press(5)48 )49 num_5.grid(row=1, column=4)50 num_6 = ttk.Button(51 master=self._frame,52 text="6",53 command=lambda: self._setter.set_press(6)54 )55 num_6.grid(row=2, column=0)56 num_7 = ttk.Button(57 master=self._frame,58 text="7",59 command=lambda: self._setter.set_press(7)60 )61 num_7.grid(row=2, column=1)62 num_8 = ttk.Button(63 master=self._frame,64 text="8",65 command=lambda: self._setter.set_press(8)66 )67 num_8.grid(row=2, column=2)68 num_9 = ttk.Button(69 master=self._frame,70 text="9",71 command=lambda: self._setter.set_press(9)72 )73 num_9.grid(row=2, column=3)74 num_0 = ttk.Button(75 master=self._frame,76 text="0",77 command=lambda: self._setter.set_press(0)78 )79 num_0.grid(row=2, column=4)8081 def _operations(self):82 add_button = ttk.Button(83 master=self._frame,84 text="+",85 command=lambda: self._setter.set_press("+")86 )87 add_button.grid(row=3, column=0)88 subtract_button = ttk.Button(89 master=self._frame,90 text="-",91 command=lambda: self._setter.set_press("-")92 )93 subtract_button.grid(row=3, column=1)94 multiply_button = ttk.Button(95 master=self._frame,96 text="*",97 command=lambda: self._setter.set_press("*")98 )99 multiply_button.grid(row=3, column=2)100 divide_button = ttk.Button(101 master=self._frame,102 text="/",103 command=lambda: self._setter.set_press("/")104 )105 divide_button.grid(row=3, column=3)106 decimal_button = ttk.Button(107 master=self._frame,108 text=",",109 command=lambda: self._setter.set_press(".")110 )111 decimal_button.grid(row=3, column=4)112 equal_button = ttk.Button(113 master=self._frame,114 text="=",115 command=lambda: self._setter.set_equation()116 )117 equal_button.grid(row=2, column=5)118 power_button = ttk.Button(119 master=self._frame,120 text=f"x**",121 command=lambda: self._setter.set_press("**")122 )123 power_button.grid(row=4, column=0)124 sqrt_button = ttk.Button(125 master=self._frame,126 text="sqrt",127 command=lambda: self._setter.set_press("sqrt(")128 )129 sqrt_button.grid(row=4, column=1)130 log_button = ttk.Button(131 master=self._frame,132 text="ln",133 command=lambda: self._setter.set_press("log(")134 )135 log_button.grid(row=4, column=2)136 sin_button = ttk.Button(137 master=self._frame,138 text="sin",139 command=lambda: self._setter.set_press("sin(")140 )141 sin_button.grid(row=5, column=0)142 cos_button = ttk.Button(143 master=self._frame,144 text="cos",145 command=lambda: self._setter.set_press("cos(")146 )147 cos_button.grid(row=5, column=1)148 tan_button = ttk.Button(149 master=self._frame,150 text="tan",151 command=lambda: self._setter.set_press("tan(")152 )153 tan_button.grid(row=5, column=2)154 neper_button = ttk.Button(155 master=self._frame,156 text="e",157 command=lambda: self._setter.set_press("e")158 )159 neper_button.grid(row=5, column=3)160 pi_button = ttk.Button(161 master=self._frame,162 text="π",163 command=lambda: self._setter.set_press("π")164 )165 pi_button.grid(row=5, column=4)166 AC_button = ttk.Button(167 master=self._frame,168 text="AC",169 command=lambda: self._setter.set_clear_expression()170 )171 AC_button.grid(row=1, column=5)172 factorial_button = ttk.Button(173 master=self._frame,174 text="factorial",175 command=lambda: self._setter.set_press("factorial(")176 )177 factorial_button.grid(row=4, column=3)178 brackets_button = ttk.Button(179 master=self._frame,180 text="( )",181 command=lambda: self._setter.set_brackets()182 )183 brackets_button.grid(row=4, column=4)184 left_bracket_button = ttk.Button(185 master=self._frame,186 text="(",187 command=lambda: self._setter.set_press("(")188 )189 left_bracket_button.grid(row=4, column=5)190 ans_button = ttk.Button(191 master=self._frame,192 text="ans",193 command=lambda: self._setter.set_ans()194 )195 ans_button.grid(row=3, column=5)196 home_button = ttk.Button(197 master=self._frame,198 text="Home",199 command=self._handle_home200 ) ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pypom_form automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful