class SilderBox(object): def __init__(self): self.sliderGroup = QtGui.QGroupBox("PWM Control") layout = QtGui.QGridLayout() #Define Sliders self.vsw_pwmSlider = Slider("VSW PWM", layout, 1, pwmRange, self.update_vswset) self.vset_pwmSlider = Slider("VSET PWM", layout, 2, pwmRange, self.update_vset) self.iset_pwmSlider = Slider("ISET PWM", layout, 3, pwmRange, self.update_iset) self.sliderGroup.setLayout(layout) def update_vswset(self): sliderValue = str(self.vsw_pwmSlider.get_slider_value()) print "VSW Slider: " + sliderValue serial_write("cmd,1," + sliderValue) def update_vset(self): sliderValue = str(self.vset_pwmSlider.get_slider_value()) print "VSET Slider: " + sliderValue serial_write("cmd,2," + sliderValue) def update_iset(self): sliderValue = str(self.iset_pwmSlider.get_slider_value()) print "ISET Slider: " + sliderValue serial_write("cmd,3," + sliderValue)
def __init__(self, display): MainScreen.__init__(self, display) self.btn_main_menu = Button(lang.data["main menu"], [ 240, 50], [340, 530], 38) self.slider = Slider() image_rool = pygame.image.load(os.path.join('images/rools.png')) self.image_rool = pygame.transform.scale( image_rool, (800, image_rool.get_height() * 800 // image_rool.get_width()))
def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.setWindowTitle("Image Binarization") layout = QVBoxLayout() self.slider = Slider() self.viewer = ImageListViewer() self.hist = Histogram() self.im_grid = ImageGrid() self.viewer.sendPath.connect(self.hist.plot_histogram) self.viewer.sendPath.connect(self.im_grid.set_images) self.im_grid.sendOtsu.connect(self.hist.plot_threshold) self.slider.sendThreshold.connect(self.im_grid.update_manual) layout.addWidget(self.slider) layout.addWidget(self.hist) layout.addWidget(self.im_grid) layout.addWidget(self.viewer) widget = QWidget() widget.setLayout(layout) self.setCentralWidget(widget) self.showMaximized()
class Rools(MainScreen): def __init__(self, display): MainScreen.__init__(self, display) self.btn_main_menu = Button(lang.data["main menu"], [ 240, 50], [340, 530], 38) self.slider = Slider() image_rool = pygame.image.load(os.path.join('images/rools.png')) self.image_rool = pygame.transform.scale( image_rool, (800, image_rool.get_height() * 800 // image_rool.get_width())) def update_screen(self): image = pygame.transform.chop( self.image_rool, (0, 0, 0, (self.slider.value / 100) * (self.image_rool.get_height() - 500))) image = pygame.transform.chop( image, (0, 500, 0, image.get_height() - 500)) self.display.blit(image, (20, 20)) self.btn_main_menu.draw(self.display) self.slider.draw(self.display) if self.btn_main_menu.active: self.show = False
def __init__(self, imp_window): super().__init__('Visual parameters') self.imp_window = imp_window vbox_main = QVBoxLayout() self.setLayout(vbox_main) self.sliders = dict() self.sliders['point_size'] = Slider('Point size', 1, 20, 8, data_type=float) self.sliders['point_size'].slider.valueChanged.connect( self.imp_window.gl_widget.update) vbox_main.addLayout(self.sliders['point_size']) self.sliders['opacity_regular'] = Slider('Opacity (regular points)', 0, 1, 0.4, data_type=float) self.sliders['opacity_regular'].slider.valueChanged.connect( self.imp_window.gl_widget.update) vbox_main.addLayout(self.sliders['opacity_regular']) self.sliders['opacity_representatives'] = Slider( 'Opacity (representatives)', 0, 1, 1, data_type=float) self.sliders['opacity_representatives'].slider.valueChanged.connect( self.imp_window.gl_widget.update) vbox_main.addLayout(self.sliders['opacity_representatives']) self.colour_data = None colour_hbox = QHBoxLayout() colour_hbox.addWidget(QLabel('Colour:')) self.colour_combo_box = QComboBox() self.colour_combo_box.currentIndexChanged.connect(self.colour_changed) colour_hbox.addWidget(self.colour_combo_box) vbox_main.addLayout(colour_hbox)
def __init__(self, mainloop: function, layers: List[LayerType], usePlayer=True) -> None: self.data: dict = {} self.layers = layers + ([LayerType.Player, LayerType.Goal] if usePlayer else [LayerType.Goal]) self.mainloop = mainloop self.isMinimised = False self.widgets = { "Slider0": Slider(Graph.pygame, 1350, Colors.brown, start=20), "Slider1": Slider(Graph.pygame, 1400, Colors.blue, start=40), "Slider2": Slider(Graph.pygame, 1450, Colors.orange, start=14), "Menu": Menu(Graph.pygame, self.updateEdges, self.updateNotes, Colors.green, 300, Colors.blue), "Toggle": Toggle(Graph.pygame, Colors.green) } self.start()
def __init__(self): self.sliderGroup = QtGui.QGroupBox("PWM Control") layout = QtGui.QGridLayout() #Define Sliders self.vsw_pwmSlider = Slider("VSW PWM", layout, 1, pwmRange, self.update_vswset) self.vset_pwmSlider = Slider("VSET PWM", layout, 2, pwmRange, self.update_vset) self.iset_pwmSlider = Slider("ISET PWM", layout, 3, pwmRange, self.update_iset) self.sliderGroup.setLayout(layout)
axDef.plot(xDat, yDat) axDef.set_xlim([xDat[0], xDat[-1]]) axDef.set_ylim(-0.5,3.0) axDef.set_xticks(xDat) axDef.set_xticklabels(xDat) for i in xDat: axDef.axvline(i, color='k', lw=0.5) axDef.set_ylabel('$\Delta H_f$ (eV)') axDef.axhline(y=0, ls='--', lw=0.5, color='k') figDef.legend(legDef, ncol=1, prop={'size': 14}, loc='center', bbox_to_anchor=(0.78, 0.25)) plt.show() if len(frags[prim]['fracs'].keys()) > 3: axSlider = plt.axes([0.1, 0.05, 0.75, 0.02]) # [left,bottom,width,height] sfree = Slider(axSlider, '$\Delta\mu_{%s}$' % str(free), round(float(solve(frags[prim]['line'].subs(x, 0))[0]), 0), 0.0, valinit=0.0, valstep=0.001, valfmt="%1.3f") sfree.on_changed(update) sfree.label.set_size(20) axChecks = plt.axes([0.1, 0.1, 0.3, 0.4], frameon=False) visibility = [shade.set_visible(False) if shade else [] for shade in shades] check = PremiumCheckButtons(axChecks, ax.lines[1:], visibility, loc=3, borderaxespad=0) check.on_clicked(shade) cid = fig.canvas.mpl_connect('button_press_event', genDefect) plt.show()
def __init__(self, imp_window): super().__init__() self.imp_window = imp_window self.dataset_view_renderer = self.imp_window.gl_widget.dataset_view_renderer controls_group = QGroupBox('History') row = QHBoxLayout() previous_view_button = QPushButton('Back') previous_view_button.clicked.connect( self.dataset_view_renderer.previous) row.addWidget(previous_view_button) next_view_button = QPushButton('Forward') next_view_button.clicked.connect(self.dataset_view_renderer.next) row.addWidget(next_view_button) controls_group.setLayout(row) self.sliders = dict() self.sliders['N_max'] = Slider('Maximum number of points', 50, 3000, 1000, data_type=int) self.sliders['repr_fraction'] = Slider('Representatives fraction', 0.01, 0.99, 0.05, data_type=float) self.sliders['zoom_fraction'] = Slider('Zoom fraction', 0.01, 0.99, 0.50, data_type=float) parameters_group = QGroupBox('Projection control') parameters_layout = QVBoxLayout() self.keep_representatives_checkbox = QCheckBox('Keep representatives') parameters_layout.addWidget(self.keep_representatives_checkbox) reproject_button = QPushButton('Reproject') reproject_button.clicked.connect(self.reproject_current_view) parameters_layout.addWidget(reproject_button) for _, slider in self.sliders.items(): parameters_layout.addLayout(slider) self.zo_continuity_checkbox = QCheckBox('Zoom-out continuity') self.zo_continuity_checkbox.setChecked(True) parameters_layout.addWidget(self.zo_continuity_checkbox) parameters_group.setLayout(parameters_layout) dataset_drop_box = FileDropWidget('Dataset input', 'Drop to load as dataset', self.read_dataset_from) labels_drop_box = FileDropWidget('Labels input', 'Drop to load as labels', self.read_labels_from) drops_hbox = QHBoxLayout() drops_hbox.addWidget(dataset_drop_box) drops_hbox.addWidget(labels_drop_box) self.vbox_main = QVBoxLayout() self.vbox_main.addWidget(controls_group) self.vbox_main.addWidget(parameters_group) self.vbox_main.addLayout(drops_hbox) self.setLayout(self.vbox_main)
axes = {'labelpad': 16, 'labelsize': 20} ticks = {'labelsize': 16} arrows = {'fontsize': 12, 'labelpad': 20} font = {'family': 'times new roman'} opt = {'font': font, 'xtick': ticks, 'ytick': ticks, 'axes': axes} for i in opt: plt.rc(i, **opt[i]) locs = [r'E:\Research\VASP Data\BiVO4-V2O5\slabs\BVO\001'] periods = [2.55] for loc in locs: load(loc, axis="Z") plot(periods=periods, # save=True ) axSlider = plt.axes([0.15, 0.05, 0.75, 0.02]) # [left,bottom,width,height] sPeriod = Slider(axSlider, 'Period', 0.001, latticelength[idir], valinit=0.001, valstep=0.001, valfmt="%1.3f") sPeriod.on_changed(update) sPeriod.label.set_size(14) plt.show()