Module Auto-GUI.auto_components.dimensions_wrapper
Expand source code
class DimensionWrapper:
"""Adds the ability to be able to get the right_edge, bottom_edge, horizontal_midpoint, and vertical_midpoints of GUI components"""
left_edge = 0
top_edge = 0
length = 0
height = 0
def __init__(self, left_edge, top_edge, length, height):
"""Initializes the object"""
self.left_edge, self.top_edge = left_edge, top_edge
self.length, self.height = length, height
def set_dimensions(self, left_edge, top_edge, length, height):
"""Sets the dimensions of this object"""
self.left_edge, self.top_edge = left_edge, top_edge
self.length, self.height = length, height
# @property automatically changes this "attribute" when the left_edge or length changes
# Can be treated as an attribute
@property
def right_edge(self):
return self.left_edge + self.length
@property
def bottom_edge(self):
return self.top_edge + self.height
@property
def horizontal_midpoint(self):
return self.left_edge + self.length / 2
@property
def vertical_midpoint(self):
return self.top_edge + self.height / 2
Classes
class DimensionWrapper (left_edge, top_edge, length, height)
-
Adds the ability to be able to get the right_edge, bottom_edge, horizontal_midpoint, and vertical_midpoints of GUI components
Initializes the object
Expand source code
class DimensionWrapper: """Adds the ability to be able to get the right_edge, bottom_edge, horizontal_midpoint, and vertical_midpoints of GUI components""" left_edge = 0 top_edge = 0 length = 0 height = 0 def __init__(self, left_edge, top_edge, length, height): """Initializes the object""" self.left_edge, self.top_edge = left_edge, top_edge self.length, self.height = length, height def set_dimensions(self, left_edge, top_edge, length, height): """Sets the dimensions of this object""" self.left_edge, self.top_edge = left_edge, top_edge self.length, self.height = length, height # @property automatically changes this "attribute" when the left_edge or length changes # Can be treated as an attribute @property def right_edge(self): return self.left_edge + self.length @property def bottom_edge(self): return self.top_edge + self.height @property def horizontal_midpoint(self): return self.left_edge + self.length / 2 @property def vertical_midpoint(self): return self.top_edge + self.height / 2
Class variables
var height
var left_edge
var length
var top_edge
Instance variables
var bottom_edge
-
Expand source code
@property def bottom_edge(self): return self.top_edge + self.height
var horizontal_midpoint
-
Expand source code
@property def horizontal_midpoint(self): return self.left_edge + self.length / 2
var right_edge
-
Expand source code
@property def right_edge(self): return self.left_edge + self.length
var vertical_midpoint
-
Expand source code
@property def vertical_midpoint(self): return self.top_edge + self.height / 2
Methods
def set_dimensions(self, left_edge, top_edge, length, height)
-
Sets the dimensions of this object
Expand source code
def set_dimensions(self, left_edge, top_edge, length, height): """Sets the dimensions of this object""" self.left_edge, self.top_edge = left_edge, top_edge self.length, self.height = length, height