PyQt5 hata vermiyor fakat açılmıyor

python da pyqt5 kullanıyorum pycharm de çalıştırdığım zaman herşey normal sıkıntı yok ama açılmıyor neden olabilir eksik dosyası yok
adsız

Kodlarınızı görmeden yanıt vermek zor.

import sys
import sqlite3

from PyQt5 import QtWidgets

class Pencere(QtWidgets.QWidget):

def __init__(self):

    super().__init__()
    self.baglanti_olustur()

    self.init_ui()

def baglanti_olustur(self):
    baglanti=sqlite3.connect("database.db")

    self.cursor=baglanti.cursor()

    self.cursor.execute("Create table if not exists üyeler(Kullanıcı_adı TEXT,parola TEXT)")

    baglanti.commit()




def init_ui(self):

    self.kullanici_adi=QtWidgets.QLineEdit("Kullanıcı Adı:")
    self.sifre=QtWidgets.QLineEdit()
    self.sifre.setEchoMode(QtWidgets.QLineEdit.Password)
    self.giris=QtWidgets.QPushButton("Giriş")
    self.yazi_alani =QtWidgets.QLabel("")



    v_box=QtWidgets.QVBoxLayout()

    v_box.addWidget(self.kullanici_adi)
    v_box.addWidget(self.sifre)
    v_box.addWidget(self.yazi_alani)

    v_box.addStretch()
    v_box.addWidget(self.giris)

    h_box =QtWidgets.QHBoxLayout()

    h_box.addStretch()
    h_box.addLayout(v_box)
    h_box.addStretch()



    self.setLayout(h_box)

    self.setWindowTitle("Kullanıcı Girişi")
    self.giris.clicked.connect(self.login)

def login(self):

    adi =self.kullanici_adi.text()
    par =self.sifre.text()
    self.cursor.execute("select *From üyeler where kullanıcı_adı=? and parola =?",(adi,par))

    data=self.cursor.fetchall()

    if len(data) ==0:
        self.yazi_alani.setText("Böyle bir kullanıcı yok\nLütfen tekrar deneyin")
    else:
        self.yazi_alani.setText("Giriş Başarılı\nHOŞ GELDİNİZ..."+adi)
    self.show()

app = QtWidgets.QApplication(sys.argv)

pencere = Pencere()

sys.exit(app.exec_())

import sys
import sqlite3

from PyQt5 import QtWidgets

class Pencere(QtWidgets.QWidget):
    def __init__(self):

     super().__init__()
     self.baglanti_olustur()

     self.init_ui()

    def baglanti_olustur(self):
        baglanti=sqlite3.connect("database.db")

        self.cursor=baglanti.cursor()

        self.cursor.execute("Create table if not exists üyeler(Kullanıcı_adı TEXT,parola TEXT)")

        baglanti.commit()




    def init_ui(self):
    
        self.kullanici_adi=QtWidgets.QLineEdit("Kullanıcı Adı:")
        self.sifre=QtWidgets.QLineEdit()
        self.sifre.setEchoMode(QtWidgets.QLineEdit.Password)
        self.giris=QtWidgets.QPushButton("Giriş")
        self.yazi_alani =QtWidgets.QLabel("")
    
    
    
        v_box=QtWidgets.QVBoxLayout()
    
        v_box.addWidget(self.kullanici_adi)
        v_box.addWidget(self.sifre)
        v_box.addWidget(self.yazi_alani)
    
        v_box.addStretch()
        v_box.addWidget(self.giris)
    
        h_box =QtWidgets.QHBoxLayout()
    
        h_box.addStretch()
        h_box.addLayout(v_box)
        h_box.addStretch()
    
    
    
        self.setLayout(h_box)
    
        self.setWindowTitle("Kullanıcı Girişi")
        self.giris.clicked.connect(self.login)

    def login(self):

        adi =self.kullanici_adi.text()
        par =self.sifre.text()
        self.cursor.execute("select *From üyeler where kullanıcı_adı=? and parola =?",(adi,par))

        data=self.cursor.fetchall()

        if len(data) ==0:
            self.yazi_alani.setText("Böyle bir kullanıcı yok\nLütfen tekrar deneyin")
        else:
            self.yazi_alani.setText("Giriş Başarılı\nHOŞ GELDİNİZ..."+adi)
        self.show()
        
app = QtWidgets.QApplication(sys.argv)
pencere = Pencere()
pencere.show()
sys.exit(app.exec_())
3 Beğeni

Teşekkürler nerde hata yapmışım acaba

Bir pencere oluşturmuşsunuz ancak bunu çağırmamışsınız. (Ekranda göstermiyorsunuz)

pencere.show()

ekledim sadece.

1 Beğeni