Example #1
0
class MyApp(QMainWindow):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.statusBar().showMessage('First Button')

        self.rbtn1 = QRadioButton('First Button', self)
        self.rbtn1.move(50, 50)
        self.rbtn1.setChecked(True)
        self.rbtn1.clicked.connect(self.rbtnClicked)

        self.rbtn2 = QRadioButton(self)
        self.rbtn2.move(50, 70)
        self.rbtn2.setText('Second Button')
        self.rbtn2.resize(200, 40)
        self.rbtn2.clicked.connect(self.rbtnClicked)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()

    def rbtnClicked(self):
        if self.rbtn1.isChecked():
            self.statusBar().showMessage('First Button')
        else:
            self.statusBar().showMessage('Second Button')
 def initUI(self):
     self.setWindowTitle(self.title)
     self.setGeometry(self.left, self.top, self.width, self.height)
     self.statusBar().showMessage('Stopped.')
     nbutton = PicButton(
         QPixmap('/media/sayan/Data/Programmer/SongX/res/neic.png'), self)
     nbutton.move(50, 13)
     nbutton.resize(55, 55)
     nbutton.setToolTip('Play next')
     nbutton.clicked.connect(self.next_on_click)
     pbutton = PicButton(
         QPixmap('/media/sayan/Data/Programmer/SongX/res/plic.png'), self)
     pbutton.move(135, 20)
     pbutton.resize(40, 40)
     pbutton.setToolTip('Play song')
     pbutton.clicked.connect(self.play_on_click)
     sbutton = PicButton(
         QPixmap('/media/sayan/Data/Programmer/SongX/res/stic.png'), self)
     sbutton.move(200, 13)
     sbutton.resize(55, 55)
     sbutton.setToolTip('Stop song')
     sbutton.clicked.connect(self.stop_on_click)
     rlabel = QLabel("pace", self)
     rlabel.move(350, 15)
     myFont = QFont()
     myFont.setBold(True)
     rlabel.setFont(myFont)
     rb1 = QRadioButton("fast", self)
     rb1.move(300, 35)
     rb1.toggled.connect(self.toggle_pace)
     rb2 = QRadioButton("slow", self)
     rb2.move(370, 35)
     rb2.setChecked(True)
     self.show()
class DigitalClock(QMainWindow):

    def __init__(self):
        QMainWindow.__init__(self)
        self.initUI()

    def initUI(self):
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.Time)
        self.timer.start(10)

        self.clock_screen = QLCDNumber(self)
        self.clock_screen.resize(250,100)

        # Added self.lcd.move and moved the clock 30px down to make space for buttons
        self.clock_screen.move(0,30)
        self.clock_screen.display(strftime("%H" + ":" + "%M"))


        self.r1 = QRadioButton("Hide seconds", self)
        self.r1.move(10, 0)
        self.r2 = QRadioButton("Show seconds", self)
        self.r2.move(110, 0)

        self.r1.toggled.connect(self.woSecs)
        self.r2.toggled.connect(self.wSecs)

        # ---------Window settings --------------------------------

        # Expanded window height by 30px

        self.setGeometry(300, 300, 250, 130)
        self.setWindowTitle("Digital Clock")
        self.setWindowIcon(QtGui.QIcon(""))
        self.show()

    # -------- Slots ------------------------------------------

    def Time(self):
        global var
        if var == True:
            self.clock_screen.display(strftime("%H" + ":" + "%M"))
        elif var == False:
            self.clock_screen.display(strftime("%H" + ":" + "%M" + ":" + "%S"))

    def wSecs(self):
        global var
        var = False

        self.resize(375, 130)
        self.clock_screen.resize(375, 100)
        self.clock_screen.setDigitCount(8)

    def woSecs(self):
        global var
        var = True

        self.resize(250, 130)
        self.clock_screen.resize(250, 100)
        self.clock_screen.setDigitCount(5)
Example #4
0
    def initUI(self):
        radioBTN1 = QRadioButton('FIRST BUTTON', self)
        radioBTN1.move(50, 30)

        radioBTN2 = QRadioButton(self)
        radioBTN2.move(50, 50)
        radioBTN2.setText('SECOND BUTTON')

        self.show_basic()
    def initUI(self):
        rbtn1 = QRadioButton('First Button', self)
        rbtn1.move(50, 50)
        rbtn1.setChecked(True)

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 70)
        rbtn2.setText('Second Button')

        self.setGeometry(300, 300, 300, 200)
        self.show()
Example #6
0
class FeatureDialog(object):
    def initUI(self):
        self.chooseImageBtn = QPushButton("..", self)
        self.lineTextImage = QLineEdit("Image Path", self)
        self.imageLabel = QLabel("Image", self)
        self.imageLabel.move(30, 30)
        self.imageLabel.resize(30, 25)
        self.lineTextImage.move(100, 30)
        self.lineTextImage.resize(200, 25)
        self.chooseImageBtn.resize(20, 25)
        self.chooseImageBtn.move(300, 30)
        self.chooseMaskBtn = QPushButton("..", self)
        self.lineTextMask = QLineEdit("ROI Path", self)
        self.labelMask = QLabel("ROI", self)
        self.labelMask.move(30, 80)
        self.labelMask.resize(30, 25)
        self.lineTextMask.resize(200, 25)
        self.lineTextMask.move(100, 80)
        self.chooseMaskBtn.resize(20, 25)
        self.chooseMaskBtn.move(300, 80)

        btn3 = QPushButton("..", self)
        self.in3 = QLineEdit("Output File Path", self)
        lb3 = QLabel("Output ", self)
        lb3.move(30, 130)
        lb3.resize(30, 25)
        self.in3.resize(200, 25)
        self.in3.move(100, 130)
        btn3.move(300, 130)
        btn3.resize(20, 25)
        self.btn4 = QPushButton("Start!", self)
        self.btn4.move(160, 250)

        label = QLabel("Process:", self)
        label.move(30, 180)
        self.pbar = QProgressBar(self)
        self.pbar.setGeometry(100, 180, 230, 25)
        self.chooseImageBtn.clicked.connect(self.chooseImage)
        self.chooseMaskBtn.clicked.connect(self.chooseMask)
        btn3.clicked.connect(self.outputFile)
        self.btn4.clicked.connect(self.runCal)
        self.lineTextImage.setReadOnly(True)
        self.lineTextMask.setReadOnly(True)
        self.in3.setReadOnly(True)
        self.fileRadiobtn = QRadioButton("Single File", self)
        self.dirRadiobtn = QRadioButton("Directory batch", self)
        self.fileRadiobtn.move(10, 10)
        self.dirRadiobtn.move(200, 10)
        self.fileRadiobtn.setChecked(True)
        # self.statusBar()
        self.setGeometry(300, 300, 370, 300)
        self.setWindowTitle('Feature Calculate Toolbox')
    def initUI(self):
        radiobutton1 = QRadioButton('First Button', self)
        radiobutton1.move(50, 50)
        radiobutton1.setChecked(True)

        radiobutton2 = QRadioButton(self)
        radiobutton2.move(50, 70)
        radiobutton2.setText('Second Button')

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()
        pass
Example #8
0
    def initUI(self):
        rbtn1 = QRadioButton('First Button', self)
        rbtn1.move(50, 50)
        rbtn1.setChecked(True)  # 기본선택값을 rbtn1번으로 지정(True)
        # 파이썬의 불린값은 첫 글자만 대문자, 자바나 자바스크립티는 올 소문자, R 은 올 대문자

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 70)
        rbtn2.setText('Second Button')

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()
Example #9
0
class Main(QWidget):
    def __init__(self):
        super(Main, self).__init__()
        self.initUI()

    def initUI(self):

        timer = QTimer(self)
        timer.timeout.connect(self.Time)
        timer.start(10)

        self.lcd = QLCDNumber(self)
        self.lcd.resize(250, 100)

        self.lcd.move(0, 30)
        self.lcd.display(strftime('%H' + ':' + '%M'))

        self.r1 = QRadioButton('Hide seconds', self)
        self.r1.move(10, 0)
        self.r2 = QRadioButton('Show seconds', self)
        self.r2.move(110, 0)

        self.r1.toggled.connect(self.woSecs)
        self.r2.toggled.connect(self.wSecs)

        self.setGeometry(300, 300, 250, 130)
        self.setWindowTitle('Clock')
        self.setWindowIcon(QIcon(''))
        self.show()

    def Time(self):
        global var
        if var == True:
            self.lcd.display(strftime('%H' + ':' + '%M'))
        elif var == False:
            self.lcd.display(strftime('%H' + ':' + '%M' + ':' + '%S'))

    def wSecs(self):
        global var
        var = False

        self.resize(375, 130)
        self.lcd.resize(375, 100)
        self.lcd.setDigitCount(8)

    def woSecs(self):
        global var
        var = True
        self.resize(250, 130)
        self.lcd.resize(250, 100)
        self.lcd.setDigitCount(5)
Example #10
0
    def initUI(self):

        # line edit
        self.editLabel = QLabel(self)
        self.editLabel.move(29, 200)

        qle = QLineEdit(self)
        qle.move(29, 220)
        qle.textChanged[str].connect(self.onChanged)

        #--------------------------------------------------

        # combo box
        self.lbl = QLabel('option1', self)
        self.lbl.move(29, 150)

        comboBox = QComboBox(self)
        comboBox.addItem('option1')
        comboBox.addItem('option2')
        comboBox.addItem('option3')
        comboBox.addItem('option4')
        comboBox.move(29, 170)

        # 옵션을 선택하면 onActivated() 메서드 호출
        comboBox.activated[str].connect(self.onActivated)

        #--------------------------------------------------

        # radio button
        rbtn1 = QRadioButton('radio Button1', self)
        rbtn1.move(29, 50)
        rbtn1.setChecked(True)
        
        rbtn2 = QRadioButton('radio Button2', self)
        rbtn2.move(29, 70)
        rbtn2.setChecked(True)

        #--------------------------------------------------

        # checkbox
        cb = QCheckBox('show title', self)
        cb.move(29, 20)
        cb.toggle() # 체크 박스의 default값은 off이기 때문에 toggle()을 사용하여 on의 상태로 전환
        cb.stateChanged.connect(self.changeTitle)

        #--------------------------------------------------

        self.setWindowTitle('QCheckBox')
        self.setGeometry(300, 300, 300, 300)
        self.show()
Example #11
0
    def initUI(self):

        rbtn1 = QRadioButton('First Button', self)
        rbtn1.move(50, 50)
        rbtn1.setChecked(True)

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 70)
        rbtn2.setText('Second Button')

        vbox = QVBoxLayout()
        vbox.addWidget(rbtn1)
        vbox.addWidget(rbtn2)

        rbtn11 = QRadioButton('First Button1', self)
        rbtn11.move(50, 100)

        rbtn22 = QRadioButton(self)
        rbtn22.move(50, 120)
        rbtn22.setText('Second Button1')

        vbox1 = QVBoxLayout()
        vbox1.addWidget(rbtn11)
        vbox1.addWidget(rbtn22)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()
Example #12
0
    def initUI(self):
        # QRadioButton을 만듦 라벨에 들어갈 텍스트와 부모 위젯을 입력
        rbtn1 = QRadioButton('First Button', self)
        rbtn1.move(50, 50)
        # 프로그램이 실행될 때 버튼이 선택되어 표시
        rbtn1.setChecked(True)

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 70)
        rbtn2.setText('Second Button')

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()
Example #13
0
    def __init__(self, parent, x, y, count, text):
        super().__init__(parent)

        self.move(x, y)
        self.radios = []

        for i in range(count):
            radio_button = QRadioButton(text[i], self)
            radio_button.move(0, (i * 22))

            radio_button.setFont(QFont("Segoe UI", 10))

            self.radios.append(radio_button)

        self.refresh()
Example #14
0
    def initUI(self):
        rbtn1 = QRadioButton('First Button', self)
        # QRadioButton을 하나 만듭니다. 라벨에 들어갈 텍스트와 부모 위젯을 입력합니다.
        rbtn1.move(50, 50)
        rbtn1.setChecked(True)
        # setChecked()를 True로 설정하면 프로그램이 실행될 때 버튼이 선택되어 표시됩니다.

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 70)
        rbtn2.setText('Second Button')
        # setText() 메서드를 통해서도 라벨의 텍스트를 설정할 수 있습니다.

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()
Example #15
0
    def initUI(self):
        # w/o claiming an instance
        QRadioButton('FIRST BUTTON', self).move(50, 30)

        # w/ claiming an instance
        rb1 = QRadioButton('SECOND BUTTON', self).move(50, 60)

        # stack function on an instance
        rb2 = QRadioButton('THIRD BUTTON', self)
        rb2.move(50, 90)

        # stack over & over
        rb3 = QRadioButton(self)
        rb3.move(50, 120)
        rb3.setText('FOURTH BUTTON')

        self.show_basic()
Example #16
0
def register_student(reg):
    global gui,line1,line2,sex,line3,line4,line5,line6,line7,line8,line9,line10
    gui = reg
    gui.resize(700,1000) # 窗口大小
    gui.center() # 窗口位置
    gui.setWindowTitle('注册') # 窗口标题
    gui.setWindowOpacity(0.97)
    lbl = gui.Label("学生注册",200,10,100,300,"#6DDF6D",50)
    lbl.setAutoFillBackground(False)
    lbl1 = gui.Label("     学号: ",70,120,50,120,size=25)
    lbl2 = gui.Label("     姓名: ",70,200,50,120,size=25)
    lbl3 = gui.Label("     性别: ",70,280,50,120,size=25)
    lbl4 = gui.Label("     班级: ",70,360,50,120,size=25)
    lbl5 = gui.Label("     专业: ",70,440,50,120,size=25)
    lbl6 = gui.Label("     学院: ",70,520,50,120,size=25)
    lbl7 = gui.Label("     电话: ",70,600,50,120,size=25)
    lbl8 = gui.Label("     生日: ",70,680,50,120,size=25)
    lbl9 = gui.Label("     密码: ",70,760,50,120,size=25)
    lbl10 = gui.Label(" 确认密码: ",70,840,50,130,size=25)

    line1 = gui.Input(200,120,"必填/格式:S1620101",50,350)
    line2 = gui.Input(200,200,"必填",50,350)
    
    sex1 = QRadioButton("女",gui)
    sex1.move(230,295)
    sex2 = QRadioButton("男",gui)
    sex2.move(330,295)
    sex = QButtonGroup(gui)
    sex.addButton(sex1,1)
    sex.addButton(sex2,2)
    sex.buttonClicked.connect(get_sex)

    line3 = "" # 防止性别未选择
    line4 = gui.Input(200,360,"必填/格式:16201",50,350)
    line5 = gui.Input(200,440,"必填",50,350)
    line6 = gui.Combo(16,200,520,50,350,college)
    line7 = gui.Input(200,600,"选填",50,350)
    line8 = gui.Input(200,680,"选填",50,350)
    line9 = gui.Input(200,760,"必填",50,350)
    line10 = gui.Input(200,840,"必填",50,350)
    line9.setEchoMode(QLineEdit.Password)
    line10.setEchoMode(QLineEdit.Password)

    btn = gui.Button('注册',100,910,show_regS_status,50,500,"white","#6DDF6D",30)
    btn = gui.Button('< 返回',10,10,return_login,30,60,"black",None,20)
    gui.show()
Example #17
0
    def initUI(self):
        self.statusBar().showMessage('First Button')

        rbtn1 = QRadioButton('First Button', self)
        rbtn1.move(50, 50)
        rbtn1.setChecked(True)
        rbtn1.clicked.connect(self.rbtnClicked)

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 70)
        rbtn2.setText('Second Button')
        rbtn2.resize(200, 40)
        rbtn2.clicked.connect(self.rbtnClicked)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton')
        self.show()
Example #18
0
class Janela(QMainWindow):
    def __init__(self, *args, **kwargs):
        super().__init__()

        self.setWindowTitle("SAM: Meme generator")
        self.resize(470,400)

        self.radiomole = QRadioButton("Eis que",self)
        self.radiomole.move(0,300)


        self.show()

        myimage = Image.open("base.png")
        text = "incrivel"
        image_editable = ImageDraw.Draw(myimage)
        title_font = ImageFont.truetype('arial.ttf', 100)
        image_editable.text((0,0), text, (255,200,200), font=title_font)
        myimage.save("result.png")
Example #19
0
class RadioButton(QtWidgets.QWidget):
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self)

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Check')

        self.rb = QRadioButton('Show title', self)
        self.rb.setFocusPolicy(Qt.NoFocus)

        self.rb.move(10, 10)
        self.rb.toggle()
        self.rb.toggled.connect(self.changeTitle)

    def changeTitle(self, value):
        if self.rb.isChecked():
            self.setWindowTitle('Check')
        else:
            self.setWindowTitle('unchecked')
Example #20
0
def register_manager(reg):
    global gui,line1,line2,sex,line3,line4,line5,line6,line7,line8
    gui = reg
    gui.resize(700,900) # 窗口大小
    gui.center() # 窗口位置
    gui.setWindowTitle('注册') # 窗口标题
    gui.setWindowOpacity(0.97)
    lbl = gui.Label("管理人员注册",200,10,100,300,"#6DDF6D",50)
    lbl.setAutoFillBackground(False)
    lbl1 = gui.Label("     工号: ",70,120,50,120,size=25)
    lbl2 = gui.Label("     姓名: ",70,200,50,120,size=25)
    lbl3 = gui.Label("     性别: ",70,280,50,120,size=25)
    lbl4 = gui.Label("     邮箱: ",70,360,50,120,size=25)
    lbl5 = gui.Label("     电话: ",70,440,50,120,size=25)
    lbl6 = gui.Label("     生日: ",70,520,50,120,size=25)
    lbl7 = gui.Label("     密码: ",70,600,50,120,size=25)
    lbl8 = gui.Label(" 确认密码: ",70,680,50,120,size=25)

    line1 = gui.Input(200,120,"必填/格式:M0001",50,350)
    line2 = gui.Input(200,200,"必填",50,350)
    
    sex1 = QRadioButton("女",gui)
    sex1.move(230,295)
    sex2 = QRadioButton("男",gui)
    sex2.move(330,295)
    sex = QButtonGroup(gui)
    sex.addButton(sex1,1)
    sex.addButton(sex2,2)
    sex.buttonClicked.connect(get_sex)

    line3 = ""
    line4 = gui.Input(200,360,"选填",50,350)
    line5 = gui.Input(200,440,"选填",50,350)
    line6 = gui.Input(200,520,"选填",50,350)
    line7 = gui.Input(200,600,"必填",50,350)
    line8 = gui.Input(200,680,"必填",50,350)
    line7.setEchoMode(QLineEdit.Password)
    line8.setEchoMode(QLineEdit.Password)

    btn = gui.Button('注册',100,810,show_regM_status,50,500,"white","#6DDF6D",30)
    btn = gui.Button('< 返回',10,10,return_login,30,60,"black",None,20)
    gui.show()
Example #21
0
    def findText(self):
        def Find():
            flag = None
            if r1.isChecked():
                self.form_widget.tab.currentWidget().findFirst(
                    l.text(), True, cs.isChecked(), True, False, False)
                flag = self.form_widget.tab.currentWidget().findNext()
            elif r2.isChecked():
                flag = self.form_widget.tab.currentWidget().findFirst(
                    l.text(), True, cs.isChecked(), True, False)
            if not flag:
                QMessageBox.information(self, 'TextPad', 'Match not found',
                                        QMessageBox.Ok, QMessageBox.Ok)

        d = QDialog(self)
        d.setWindowTitle('Find')
        d.setWindowIcon(QIcon('icon.png'))
        d.setFixedSize(300, 130)

        label = QLabel("What to find", d)
        label.move(10, 5)
        l = QLineEdit(d)
        l.move(100, 5)
        b1 = QPushButton("Find Next", d)
        b1.move(210, 5)
        b1.clicked.connect(Find)
        b2 = QPushButton("Cancel", d)
        b2.move(210, 35)
        b2.clicked.connect(d.close)
        cs = QCheckBox("Case sensitive", d)
        cs.move(10, 62)
        f = QFrame(d)
        f.setFixedSize(120, 40)
        f.move(120, 59)
        f.setToolTip('Direction')
        r1 = QRadioButton("Up", f)
        r1.move(5, 5)
        r2 = QRadioButton("Down", f)
        r2.setChecked(True)
        r2.move(55, 5)
        d.show()
Example #22
0
    def __init__(self):
        global checkboxes, radios
        # Konstruktor von QMainWindow aufrufen
        super().__init__()

        # Fenstergröße und Titel einstellen
        self.setMinimumSize(QSize(300, 200))    
        self.setWindowTitle('Optionen') 

        for i in range(1, 6):
            c = QCheckBox('Checkbox %d' % (i), self)
            c.resize(100, 25)
            c.move(20, 30 * i)
            checkboxes += [c]
            c.toggled.connect(self.toggled)
            
            r = QRadioButton('Button %d' % (i), self)
            r.resize(100, 25)
            r.move(180, 30 * i)
            radios += [r]
            r.toggled.connect(self.toggled)
Example #23
0
    def Init_window(self):
        self.button = QPushButton("open File", self)
        self.button.setGeometry(100, 75, 100, 50)
        self.button.clicked.connect(self.OpenFileDialog)

        self.textedit = QTextEdit(self)
        self.textedit.setGeometry(75, 150, 400, 300)

        button = QPushButton("Submit", self)
        button.move(500, 400)

        RadioButton = QRadioButton("Degree_Centrality ", self)
        RadioButton.move(500, 250)
        RadioButton.toggled.connect(self.RadioButtonChanged)

        RadioButton1 = QRadioButton("Closeness_Centrality ", self)
        RadioButton1.move(500, 300)
        RadioButton1.toggled.connect(self.RadioButtonChanged1)

        RadioButton2 = QRadioButton("Betweeness_Centrality ", self)
        RadioButton2.move(500, 350)
        RadioButton2.toggled.connect(self.RadioButtonChanged2)

        self.setWindowTitle(self.titel)
        self.setGeometry(self.top, self.left, self.width, self.height)
        self.show()
    def init_radio_buttons(self):
        """
        Creates section with mode selection
        """

        top_margin = 115
        radio_label = QLabel('2. Select mode', self)
        radio_label.setObjectName("headline")
        radio_label.move(60, top_margin)

        radiobutton = QRadioButton(
            "csv (Images in selected folder are labeled and then csv file with assigned labels is generated.)",
            self)
        radiobutton.setChecked(True)
        radiobutton.mode = "csv"
        radiobutton.toggled.connect(self.mode_changed)
        radiobutton.move(60, top_margin + 35)

        radiobutton = QRadioButton(
            "copy (Creates folder for each label. Labeled images are copied to these folders. Csv is also generated)",
            self)
        radiobutton.mode = "copy"
        radiobutton.toggled.connect(self.mode_changed)
        radiobutton.move(60, top_margin + 65)

        radiobutton = QRadioButton(
            "move (Creates folder for each label. Labeled images are moved to these folders. Csv is also generated)",
            self)
        radiobutton.mode = "move"
        radiobutton.toggled.connect(self.mode_changed)
        radiobutton.move(60, top_margin + 95)
class tableDialog(QDialog):
    def __init__(self, parent, FileStructure):
        super(tableDialog, self).__init__(parent)
        self.setWindowTitle("Generate table")
        self.button_generate = QPushButton("Generate", self)
        self.button_generate.move(110, 80)

        self.radio_button_1 = QRadioButton('Option 1', self)
        self.radio_button_2 = QRadioButton('Option 2', self)
        self.radio_button_3 = QRadioButton('Option 3', self)
        self.radio_button_1.move(20, 50)
        self.radio_button_2.move(120, 50)
        self.radio_button_3.move(220, 50)
        self.radio_button_group_1 = QButtonGroup()
        self.radio_button_group_1.addButton(self.radio_button_1)
        self.radio_button_group_2 = QButtonGroup()
        self.radio_button_group_2.addButton(self.radio_button_2)
        self.radio_button_group_3 = QButtonGroup()
        self.radio_button_group_3.addButton(self.radio_button_3)
        self.button_generate.clicked.connect(self.on_generate)

        self.F = copy.deepcopy(FileStructure)

    def on_generate(self):

        self.exec_()
        self.close()
        self.destroy()

    def __generate_table(self):
        pass
Example #26
0
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.canvas = Canvas(self, (850, 620))
        self.canvas.move(30, 30)
        self.setFixedSize(1000, 720)
        self.canvas.move(10, 10)

        self.canvas.setCursor(Qt.CrossCursor)

        self.init_UI()
        self.show()

    def init_UI(self):
        self.backbtn = QPushButton('디렉터리 선택', self)
        self.backbtn.resize(110, 50)
        self.backbtn.move(20, 640)
        self.backbtn.clicked.connect(self.canvas.ButtonClickedFile)

        self.prebtn = QPushButton('<', self)
        self.prebtn.resize(110, 50)
        self.prebtn.move(730, 640)
        self.prebtn.clicked.connect(self.canvas.preImage)

        self.nextbtn = QPushButton('>', self)
        self.nextbtn.resize(110, 50)
        self.nextbtn.move(850, 640)
        self.nextbtn.clicked.connect(self.canvas.nextImage)

        self.rbtn1 = QRadioButton('Dog', self)
        self.rbtn1.move(880, 50)
        self.rbtn1.setChecked(True)
        self.rbtn1.clicked.connect(self.canvas.changeMouseMoveEvent2)

        self.rbtn2 = QRadioButton('Cat', self)
        self.rbtn2.move(880, 80)
        self.rbtn2.clicked.connect(self.canvas.changeMouseMoveEvent3)
Example #27
0
    def init(self):
        self.resize(500, 500)
        self.setWindowTitle("微信公众号:学点编程吧")
        line = QLineEdit(self)
        line.move(100, 120)
        check = QCheckBox("选我", self)
        check.move(300, 120)
        line.setStyleSheet("background: yellow")  # 背景红色
        check.setStyleSheet("color: red")  # 样式红色

        bt = QPushButton("按钮", self)
        bt.move(100, 180)
        rt = QRadioButton("单选", self)
        rt.move(200, 180)

        qcom = QComboBox(self)
        qcom.move(100, 250)
        lists = ["apple", "banana", "pear", "peach"]
        qcom.addItems(lists)

        groupbox = QGroupBox("分组", self)
        bt1 = QPushButton("按钮1", self)
        bt2 = QPushButton("按钮2", self)
        vbox = QVBoxLayout(self)
        vbox.addWidget(bt1)
        vbox.addWidget(bt2)
        groupbox.setLayout(vbox)

        qApp.setStyleSheet(
            "QGroupBox, QGroupBox * { color: red; } ")  # 全局按钮组红色

        with codecs.open("xx.qss", "r") as f:
            style = f.read()
        self.setStyleSheet(style)
        # 读取qss样式,并设置

        self.show()
Example #28
0
    def initUI(self):
        rbtn1 = QRadioButton('First Button', self)
        rbtn1.move(50, 0)
        rbtn1.setChecked(True)

        rbtn2 = QRadioButton(self)
        rbtn2.move(50, 20)
        rbtn2.setText('Second Button')

        self.lbl = QLabel('Option1', self)
        self.lbl.move(50, 150)

        cb = QComboBox(self)
        cb.addItem('Option1')
        cb.addItem('Option2')
        cb.addItem('Option3')
        cb.addItem('Option4')
        cb.move(50, 50)

        cb.activated[str].connect(self.onActivated)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QRadioButton & QComboBox')
        self.show()
Example #29
0
 def menuradiobutton(self):
     """Define menu with radio button, selectable one at time"""
     radio_install = QRadioButton("Install", self)
     radio_install.move(50, 25)
     radio_update = QRadioButton("Update", self)
     radio_update.move(50, 50)
     radio_remove = QRadioButton("Remove", self)
     radio_remove.move(50, 75)
     # connect signal and slot function
     radio_install.toggled.connect(self.radio_install_clicked)
     radio_update.toggled.connect(self.radio_update_clicked)
     radio_remove.toggled.connect(self.radio_remove_clicked)
    def init_user_interface(self):
        r_btn1 = QRadioButton('First Button', self)
        r_btn1.move(50, 50)
        r_btn1.setChecked(True)

        r_btn2 = QRadioButton('Second Button', self)
        r_btn2.move(50, 70)

        r_btn3 = QRadioButton('Third Button', self)
        r_btn3.move(50, 90)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('Radio Button')
        self.show()
Example #31
0
File: SafeB.py Project: lebik/SafeB
class SafeB(QWidget):
    def __init__(self):
        super().__init__()
        self.setAcceptDrops(True)
        self.initUI()

    def initUI(self):
        self.center()
        self.setFixedSize(435, 400)
        self.setWindowTitle('SafeB')
        self.setWindowIcon(QIcon('logo.png'))

        # Add LineEdit for Puth
        self.line_edit = QLineEdit(self)
        self.line_edit.setReadOnly(True)
        self.line_edit.resize(250, 23)
        self.line_edit.move(5, 5)
        self.line_edit.setText('Path to file')
        self.line_edit.setStyleSheet("color: rgb(167, 167, 167);")
        self.line_edit.setAcceptDrops(True)
        self.line_edit.textChanged.connect(self.onChangedPath)

        self.radio1 = QRadioButton(self)
        self.radio1.setText('one image')
        self.radio1.move(262, 37)
        self.radio1.setChecked(True)
        config.rad1 = self.radio1

        self.radio2 = QRadioButton(self)
        self.radio2.setText('few images')
        self.radio2.move(340, 37)
        config.rad2 = self.radio2

        # Add LineEdit for Username
        self.username = QLineEdit(self)
        self.username.resize(250, 23)
        self.username.move(5, 33)
        self.username.setText('Username')
        self.username.setStyleSheet("color: rgb(167, 167, 167);")
        self.username.textChanged.connect(self.onChanged2)
        self.username.mousePressEvent = lambda _: \
            self.username.selectAll()
        config.usern = self.username

        # Add LineEdit for Password
        self.password = QLineEdit(self)
        self.password.resize(250, 23)
        self.password.move(5, 61)
        self.password.setText('Password')
        self.password.setStyleSheet("color: rgb(167, 167, 167);")
        self.password.textChanged.connect(self.onChanged)
        self.password.mousePressEvent = lambda _: \
            self.password.selectAll()
        config.pwd = self.password

        # Add result textline
        self.resultText = QLabel(self)
        self.resultText.move(262, 50) #262
        self.resultText.resize(200, 46)
        self.resultText.setText('Score: ')
        self.resultText.setStyleSheet("color: rgb(167, 167, 167);")
        config.res = self.resultText


        # Add LineEdit for classifier_ids
        self.classifier_ids = QLineEdit(self)
        self.classifier_ids.resize(250, 23)
        self.classifier_ids.move(5, 89)
        self.classifier_ids.setText('Classifier_ids')
        self.classifier_ids.setStyleSheet("color: rgb(167, 167, 167);")
        self.classifier_ids.textChanged.connect(self.onChanged3)
        self.classifier_ids.mousePressEvent = lambda _: \
            self.classifier_ids.selectAll()
        config.c_id = self.classifier_ids

        # image for send
        self.pic = QLabel(self)
        self.pic.resize(567, 278)
        self.pic.move(5, 117)
        config.pic = self.pic

        # Add AddButton to type the Puth
        self.btn_add = QPushButton('Add', self)
        self.btn_add.resize(self.btn_add.sizeHint())
        self.btn_add.move(260, 5)
        self.btn_add.clicked.connect(self.showDialog)
        config.addB = self.btn_add

        # Add SendButton to send a picture
        self.btn_send = QPushButton('Send', self)
        self.btn_send.resize(self.btn_send.sizeHint())
        self.btn_send.move(340, 5)
        self.btn_send.clicked.connect(self.sendPic)
        config.sendB = self.btn_send

        self.show()

    def showDialog(self):
        if self.radio1.isChecked():
            path = QFileDialog.getOpenFileName()
        else:
            path = QFileDialog.getExistingDirectory()
        if ''.join(path) != '':
            config.path = ''.join(path)
            self.line_edit.setText(config.path)

    def onChangedPath(self, text):
        self.line_edit.setStyleSheet("color: rgb(0, 0, 0);")
        if text[0:8] == 'file:///':
            config.path = text[8:]
            self.line_edit.setText(config.path)
        # use full ABSOLUTE path to the image, not relative
        try:
            self.pic.setPixmap(QtGui.QPixmap(config.path).scaledToHeight(278))
        except:
            print('Not image!')
        str = config.path
        str_split = str.split('/')
        if parse_name(str_split):
            self.radio1.setChecked(True)
        else:
            self.radio2.setChecked(True)

    def onChanged(self, text):
        config.password = text
        self.password.setEchoMode(2)
        self.password.setStyleSheet("color: rgb(0, 0, 0);")

    def onChanged2(self, text):
        config.username = text
        self.username.setStyleSheet("color: rgb(0, 0, 0);")

    def onChanged3(self, text):
        config.classifier_ids = text
        self.classifier_ids.setStyleSheet("color: rgb(0, 0, 0);")

    def sendPic(self):
        self.resultText.setText('Processing...')
        self.resultText.setStyleSheet("color: rgb(0, 0, 0);")
        self.btn_send.setEnabled(False)
        self.btn_add.setEnabled(False)
        self.radio1.setEnabled(False)
        self.radio2.setEnabled(False)
        config.usern.setEnabled(False)
        config.pwd.setEnabled(False)
        config.c_id.setEnabled(False)
        runnable = Runnable()
        QtCore.QThreadPool.globalInstance().start(runnable)

    def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls():
            event.acceptProposedAction()
        else:
            super(SafeB, self).dragEnterEvent(event)

    def dropEvent(self, e):
        self.line_edit.setStyleSheet("color: rgb(0, 0, 0);")
        self.line_edit.setText(e.mimeData().text())
        config.path = self.line_edit.text()
Example #32
0
    def initUI(self):

        widget = QWidget()
        layout=QVBoxLayout() 
        
        
        label_class = QLabel(self)
        label_binar = QLabel(self)
        label_method = QLabel(self)
        label_class.move(25,60)
        label_class.setText('Выберите тип \n видеолекции')
        label_binar.move(135,60)
        label_binar.setText('Выберите метод \n бинаризации')
        label_method.move(275,60)
        label_method.setText('Выберите способ \n сравнения')
        exitAction = QAction(QIcon('start.png'), 'Начать обрабатывать видео', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.triggered.connect(self.buttonClicked)



        self.toolbar = self.addToolBar('Exit')
        self.toolbar.addAction(exitAction)


        openFile = QAction(QIcon('exit.png'), 'Open video file', self)
        openFile.setStatusTip('Open new File')
        openFile.triggered.connect(self.showDialog)
        
        
        openPdf = QAction(QIcon('open.png'), 'Open pdf or pptx file', self)
        openPdf.triggered.connect(self.showDialogPdf)

        stope = QAction(QIcon('stope.png'), 'Остановить', self)
        stope.triggered.connect(self.stopall)

        testvideo = QAction(QIcon('test.png'), 'Тестовый режим', self)
        testvideo.triggered.connect(self.showDialogTest)

        useperspectiv = QAction(QIcon('check.png'), 'Использовать перспективное преобразование', self,checkable=True)
        
        useperspectiv.triggered.connect(self.showUsePerspectiv)
      
        numberofcadrs = QAction(QIcon('check23.png'), 'Сравнивать каждый N кадр', self)

        numberofcadrs.triggered.connect(self.shownumberofcadrs)

        wordsforslides = QAction(QIcon('check.png'), 'Выводить слова для каждого слайда', self,checkable=True)

        wordsforslides.triggered.connect(self.showwordsforslides)

        cropwindow = QAction(QIcon('check.png'), 'Выводить окно слайдов', self,checkable=True)

        cropwindow.triggered.connect(self.showcropwindow)

        binarwindow = QAction(QIcon('check.png'), 'Выводить окно бинаризации', self,checkable=True)

        binarwindow.triggered.connect(self.showbinarwindow)

        videowindow = QAction(QIcon('check.png'), 'Выводить окно видео', self,checkable=True)

        videowindow.triggered.connect(self.showvideowindow)

        binar_group=QButtonGroup(self.toolbar) 
        method_group = QButtonGroup(self.toolbar) 
        class_video = QButtonGroup(self.toolbar)

        rb11 = QRadioButton('1',self)
        rb12 = QRadioButton('2',self)
        rb13 = QRadioButton('3',self)
        rb11.move(50, 100)
        rb12.move(50, 125)
        rb13.move(50, 150)
        class_video.addButton(rb11)
        class_video.addButton(rb12)
        class_video.addButton(rb13)
        rb12.setChecked(True)

        rb1=QRadioButton('Otsu',self)
        rb2=QRadioButton('Simple + усиление',self)
        rb3=QRadioButton('Simple',self)
        rb1.move(150,100)
        rb2.move(150,125)
        rb3.move(150,150)
        binar_group.addButton(rb1)
        binar_group.addButton(rb2)
        binar_group.addButton(rb3)
       
        self.toolbar.addAction(stope)
        self.toolbar.addAction(testvideo)
        rb1.toggled.connect(self.checkedrb1)
        rb2.toggled.connect(self.checkedrb2)
        rb3.toggled.connect(self.checkedrb3)


        rb1.setChecked(True)

        
        rb4=QRadioButton('OCR + SIFT',self)
        rb7=QRadioButton('OCR + SURF',self)
        rb5=QRadioButton('Only SIFT',self)
        rb6=QRadioButton('Only SURF',self)
        rb8=QRadioButton('Only pHash',self)
        rb4.move(275,100)
        rb5.move(275,150)
        rb6.move(275,175)
        rb7.move(275,125)
        rb8.move(275,200)
        rb4.toggled.connect(self.checkedrb4)
        rb5.toggled.connect(self.checkedrb5)
        rb6.toggled.connect(self.checkedrb6)
        rb7.toggled.connect(self.checkedrb7)
        rb8.toggled.connect(self.checkedrb8)
        rb4.setChecked(True)

        method_group.addButton(rb4)
        method_group.addButton(rb5)
        method_group.addButton(rb6)
        method_group.addButton(rb7)
        method_group.addButton(rb8)


        rb11.toggled.connect(self.checkedrb11)
        rb12.toggled.connect(self.checkedrb12)
        rb13.toggled.connect(self.checkedrb13)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        SettingsMenu = menubar.addMenu('&Settings')
        SettingsMenu.addAction(numberofcadrs)
        SettingsMenu.addAction(useperspectiv)
        SettingsMenu.addAction(wordsforslides)
        SettingsMenu.addAction(cropwindow)
        SettingsMenu.addAction(binarwindow)
        SettingsMenu.addAction(videowindow)
        fileMenu.addAction(openFile)
        fileMenu.addAction(openPdf)
        fileMenu.addAction(stope)
        self.setGeometry(300, 300, 450, 250)
        self.setWindowTitle('DiplomProject')

        self.show()