本文整理汇总了Python中Point.Point._get_x方法的典型用法代码示例。如果您正苦于以下问题:Python Point._get_x方法的具体用法?Python Point._get_x怎么用?Python Point._get_x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point.Point
的用法示例。
在下文中一共展示了Point._get_x方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: App
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import _get_x [as 别名]
#.........这里部分代码省略.........
# MAJ map
del self.map[id]
print("regeneration" + id.__str__())
self.map[newIdForme]._set_nom(self.entry_droite_name.get())
# MAJ mapGroupe
del self.mapGroupe[self.GroupeActif].listeforme[id]
self.mapGroupe[self.GroupeActif].listeforme[newIdForme] = 1
self.root.update()
else: # id pas defini
self.cv.delete(self.root, self.idForme)
self.forme_active.write()
newIdForme = self.fabrique.fabriquer_forme(self.forme_active, self.cv)
self.map[newIdForme] = deepcopy(self.map[self.idForme])
# MAJ map
del self.map[self.idForme]
print("regeneration" + self.idForme.__str__())
self.idForme = newIdForme
self.map[self.idForme]._set_nom(self.entry_droite_name.get())
self.forme_active = self.map[self.idForme]
self.root.update()
def modifByEdit(self, event):
# active les ENTRY si une forme est selectionne
if self.forme_active._get_nom() != "":
self.forme_active._set_couleur(self.color_name)
pos = self.entry_droite_point1.get().find(",")
difference = [
self.forme_active._get_point1()._get_x() - (int(self.entry_droite_point1.get()[0:pos])),
self.forme_active._get_point1()._get_y()
- int(self.entry_droite_point1.get()[pos + 1 : len(self.entry_droite_point1.get())]),
]
self.forme_active._set_point1(
Point(
int(self.entry_droite_point1.get()[0:pos]),
int(self.entry_droite_point1.get()[pos + 1 : len(self.entry_droite_point1.get())]),
)
)
self.forme_active._set_point2(
Point(
self.forme_active._get_point2()._get_x() - difference[0],
self.forme_active._get_point2()._get_y() - difference[1],
)
)
self.x1, self.y1 = self.entry_droite_point1.get(), self.entry_droite_point2.get()
self.regenererForme()
self.majEntry()
print("modif")
def majEntry(self):
if self.idForme is not None and self.GroupeActif == -1:
# FORME SIMPLE
print("=========majEntry=========")
print("IDFORME :" + self.idForme.__str__())
print("MAP: " + self.map.__str__())
print("FORMEACTIVE: " + self.forme_active._get_nom())
# nom
self.Valeur_entry_nom.set(self.map[self.idForme]._get_nom())
示例2: FormesSimples
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import _get_x [as 别名]
class FormesSimples(Formes):
def __init__(self, nom, point1, point2, couleur):
super(FormesSimples,self).__init__(nom)
self._point1 = point1
self._point2 = point2
self._couleur = couleur
#_couleur
def _get_couleur(self):
return self._couleur
def _set_couleur(self, couleur):
self._couleur = couleur
#_point1
def _get_point1(self):
return self._point1
def _set_point1(self, point):
self._point1._set_x(point._get_x());
self._point1._set_y(point._get_y());
#_point2
def _get_point2(self):
return self._point2
def _set_point2(self, point):
self._point2._set_x(point._get_x());
self._point2._set_y(point._get_y());
couleur = property (_get_couleur, _set_couleur)
point1 = property (_get_point1, _set_point1)
point2 = property (_get_point2, _set_point2)
def maj(self, p1, p2):
super().maj()
self._set_couleur(self.couleur);
self._set_point1(Point(p1._get_x(), p1._get_y()));
self._set_point2(Point(p2._get_x(), p2._get_y()));
def write(self):
super().write()
print("nom = " + self._get_nom() + " Point1 = (" + self._get_point1().x.__str__() + "," + self._get_point1().y.__str__() + ") Point2 = (" + self._get_point2().x.__str__() + "," + self._get_point2().y.__str__() +")")
def translation(self, x, y):
super().translation()
#Modif des points
self._point1 = Point(self._point1._get_x() + x, self._point1._get_y() + y)
self._point2 = Point(self._point2._get_x() + x, self._point2._get_y() + y)
def zoom(self, action, coef):
super().zoom()
if(action):
#Modif des points
AModifX = round( ((self._get_largeur() * coef) - self._get_largeur()) / 2 , 0)
AModifY = round( ((self._get_hauteur() * coef) - self._get_hauteur()) / 2 , 0 )
self._point1 = Point(self._point1._get_x() - AModifX, self._point1._get_y() - AModifY)
self._point2 = Point(self._point2._get_x() + AModifX, self._point2._get_y() + AModifY)
else:
#Modif des points
AModifX = round( ((self._get_largeur() / coef) - self._get_largeur()) / 2 , 0)
AModifY = round( ((self._get_hauteur() / coef) - self._get_hauteur()) / 2 , 0 )
self._point1 = Point(self._point1._get_x() - AModifX, self._point1._get_y() - AModifY)
self._point2 = Point(self._point2._get_x() + AModifX, self._point2._get_y() + AModifY)
def _get_hauteur(self):
return round(abs(self._point1._get_y() - self._get_point2()._get_y()), 0)
def _get_largeur(self):
return round(abs(self._point1._get_x() - self._get_point2()._get_x()), 0)
def _get_milieu(self):
#X
if self._point1._get_x() < self._point2._get_x() :
x = self._point1._get_x() + self._get_largeur() / 2
else:
x = self._point2._get_x() + self._get_largeur() / 2
#Y
if self._point1._get_y() < self._point2._get_y() :
y = self._point1._get_y() + self._get_hauteur() / 2
else:
y = self._point2._get_y() + self._get_hauteur() / 2
return Point(x, y)