Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Button click doesnt work from my second class/layout in Python
I am using PyQt5 and I have designed 3 layouts.


Login and Dashboard pages have individual class files. When I am trying to login, it gets logged in. After that, I am trying to click the settings button from my dashboard, but nothing happens. The layout doesnt change.

Whereas, if I individually run the dashboard file, clicking on the settings button works and the layout changes. I am like confused, why this is happening. Here is a piece of my code:

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from login import Ui_loginWindow
from dashboard import Ui_dashboardWindow

class loginClass(Ui_loginWindow):
def __init__(self,dialog):

def openDashboard(self):
self.newWindow = QtWidgets.QMainWindow()
self.dashboardWindow = Ui_dashboardWindow()
loginWindow.hide() #works #works

if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
loginWindow = QtWidgets.QMainWindow()
var = loginClass(loginWindow)

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from dashboard import Ui_dashboardWindow
from settings import Ui_settingsWindow

class dashboardClass(Ui_dashboardWindow):
def __init__(self,dialog):

def openSettings(self):
self.newWindow = QtWidgets.QMainWindow()
self.addWindow = Ui_addWindow()
dashboardWindow.hide() #doesnot work #doesnot work

if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
dashboardWindow = QtWidgets.QMainWindow()
var = dashboardClass(dashboardWindow)


The above image explains what I basically want to achieve.


ok @Larz60+ but I am unable to edit my post now.
Larz60+ wrote Feb-13-2018, 12:16 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Reset Button did not work ardvci 2 92 Mar-02-2020, 07:59 PM
Last Post: ardvci
  [Tkinter] Checking button click in Tkinter GalaxyCoyote 3 488 Oct-20-2019, 03:28 AM
Last Post: GalaxyCoyote
  [PyQt] Problem how to click a button inside a group box? mart79 2 390 Aug-05-2019, 01:21 PM
Last Post: mart79
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 664 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  Button in one class, methods in another one alan9979 4 472 Jul-11-2019, 01:57 AM
Last Post: joe_momma
  clear button destroy can't work jacklee26 1 613 Jul-07-2019, 03:44 AM
Last Post: DeaD_EyE
  [Tkinter] Problems with frames layout Gupi 1 406 May-27-2019, 09:41 AM
Last Post: Yoriz
  [Tkinter] Tkinter window pop up again when i click button Orimura_Sandy 1 896 May-12-2019, 08:17 PM
Last Post: joe_momma
  [Tkinter] Not getting entry values on button click & treeview not updating ? swanysto 4 1,896 May-10-2019, 04:16 PM
Last Post: swanysto
  Simple Button click on image file to create action? jpezz 4 739 Mar-27-2019, 10:08 PM
Last Post: jpezz

Forum Jump:

Users browsing this thread: 1 Guest(s)