self.axes = self.fig.add_axes([0, 0, 1, 1]) layout = QtGui.QHBoxLayout() layout.addWidget(self.fc) layout.setMargin(0) self.setLayout(layout) def imshow(self, img): self.axes.clear() self.axes.axis("off") self.axes.imshow(img, cmap=get_cmap("binary")) self.fc.draw() if __name__ == "__main__": import gen_pattern as gp qApp = QtGui.QApplication(sys.argv) SLM = SLMDialog() aux_mat = gp.prepare_aux_matrices(512) p_lg = gp.gen_lg_pattern(3, 3, aux_mat, 4) p_g = gp.gen_blaze_grating(50, aux_mat) pm = gp.phasemap(p_lg + p_g) # pm = gp.phasemap(p_lg) SLM.imshow(pm) SLM.show() sys.exit(qApp.exec_())
layout.setMargin(0) self.setLayout(layout) self.setGeometry(1681, 1050-768, 768, 768) self.fc.mpl_connect('button_press_event', self.close_on_click) def close_on_click(self, event): self.close() def imshow(self, img): axes = self.fig.add_axes([0,0,1,1]) axes.axis('off') axes.imshow(img, cmap=get_cmap('binary')) if __name__ == '__main__': import gen_pattern as gp qApp = QtGui.QApplication(sys.argv) SLM = SLM_Dialog() p_lg = gp.gen_lg_pattern(768,3,3,4) p_g = gp.gen_blaze_grating(768,50, 0.9) pm = gp.phasemap(p_lg + p_g) #pm = gp.phasemap(p_lg) SLM.imshow(pm) SLM.show() sys.exit(qApp.exec_())
self.axes = self.fig.add_axes([0, 0, 1, 1]) layout = QtGui.QHBoxLayout() layout.addWidget(self.fc) layout.setMargin(0) self.setLayout(layout) def imshow(self, img): self.axes.clear() self.axes.axis('off') self.axes.imshow(img, cmap=get_cmap('binary')) self.fc.draw() if __name__ == '__main__': import gen_pattern as gp qApp = QtGui.QApplication(sys.argv) SLM = SLMDialog() aux_mat = gp.prepare_aux_matrices(512) p_lg = gp.gen_lg_pattern(3, 3, aux_mat, 4) p_g = gp.gen_blaze_grating(50, aux_mat) pm = gp.phasemap(p_lg + p_g) #pm = gp.phasemap(p_lg) SLM.imshow(pm) SLM.show() sys.exit(qApp.exec_())