本文整理汇总了Python中multiprocessing.Manager.copy方法的典型用法代码示例。如果您正苦于以下问题:Python Manager.copy方法的具体用法?Python Manager.copy怎么用?Python Manager.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.Manager
的用法示例。
在下文中一共展示了Manager.copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EconomyFrame
# 需要导入模块: from multiprocessing import Manager [as 别名]
# 或者: from multiprocessing.Manager import copy [as 别名]
class EconomyFrame(Frame):
def __init__(self, map_limits, queue, shutdown):
Frame.__init__(self)
self.circle = dict()
self.map_limits = map_limits
self.map_type_of_agent = Manager().dict()
self.agent_type_color_map = \
{0: "black",
1: "blue",
2: "green"}
self.information_getter = InformationGetter(self.map_type_of_agent, queue, shutdown)
self.information_getter.start()
self.timer = QTimer()
self.timer.setInterval(0)
self.timer.timeout.connect(self.repaint)
self.timer.start()
def draw(self):
map_type_of_agent = self.map_type_of_agent.copy()
for position, to_print in map_type_of_agent.items():
rectangle = QRect(position[0]*self.circle["width"],
position[1]*self.circle["height"],
self.circle["width"],
self.circle["height"])
agent_type = to_print[0]
agent_object = to_print[1]
set_angle = 0
size = 180*16
self.painter.setBrush(self.brush[self.agent_type_color_map[agent_type]])
self.painter.drawPie(rectangle, set_angle, size)
set_angle = 180 * 16
size = 180 * 16
self.painter.setBrush(self.brush[self.agent_type_color_map[agent_object]])
self.painter.drawPie(rectangle, set_angle, size)
# self.painter.drawEllipse(rectangle)
def adapt_size_to_window(self, window_size):
for i in ["width", "height"]:
self.circle[i] = window_size[i] / float(self.map_limits[i])
self.repaint()