Q:

Pyside - Change entire GUI when button is pressed

I'm totally new to pyside and I'm having a problem with my little program (and pyside layouts in general). 
What I have is an UI with some QlineEdits, comboboxes and a button. After I have filled out the Qlines and press the button I want to either to open a new window with a completely new layout or preferably clear out the open window and fill it with a new layout based on the input from the qlines. Perhaps this is super basic but I can't get it to work. The reason is that I can't grasp how I would be able to replace or add new stuff to my gui when it's already set and shown. 
Let's say I have a script like this:
import sys
import os

from PySide import QtCore, QtGui

class BasicGui(QtGui.QWidget):

    def __init__(self):
        super(Example, self).__init__()

        self.initUI()

    def initUI(self):

        self.projectNameLbl1 = QtGui.QLabel('Label1')
        self.projectNameLbl2 = QtGui.QLabel('Label2')

        self.nextBtn = QtGui.QPushButton("Next")

        self.projectNameEdit = QtGui.QLineEdit(self)
        self.projectNameEdit2 = QtGui.QLineEdit(self)

        grid = QtGui.QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.projectNameLbl1, 2, 0)
        grid.addWidget(self.projectNameEdit, 2, 1)
        grid.addWidget(self.projectNameLbl2, 3, 0)
        grid.addWidget(self.projectNameEdit2, 3, 1)

        grid.addWidget(self.nextBtn, 4, 1)

        self.setLayout(grid)

        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('projectCreator')    
        self.show()
        self.nextBtn.clicked.connect(self.nextPressed)

    def nextPressed(self):
        self.msgBox = QtGui.QMessageBox()
        self.msgBox.setText("When this button is pressed I want to generate a new layout")
        self.msgBox.exec_()

def main():

    app = QtGui.QApplication(sys.argv)
    ex = BasicGui()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

Say that I enter 10 in the line next to label1 and 2 in the other and press Next.Now I want to clear everything out and create 2 new columns with 10 qlines in each (or something like that).
Excuse me if I'm being either to vague or if I'm just repeating myself. I'm tired and irritated  and English is not my first language.
I would deeply appreciate any help I could get or a push in the right direction.
Edit: If it's easier to accomplish this with some other widgetype with tabs or something that's fine. All i want to do is generate new widgets after i have recieved input from the user.

A:

What you'll want to do is used a QStackedLayout[1].

Create a QWidget.
Create your layout.
Call setLayout() on the widget with your layout as the argument.
Push the new widget onto the QStackedLayout.
Use QStackedLayout's setCurrentIndex() or setCurrentWidget() functions to set the current layout.

I did something similar in a project of mine. See https://github.com/shanet/Cryptully/blob/master/cryptully/qt/qChatTab.py for a more complete example. Also see Pyside Changing Layouts for a similar problem.
[1] http://qt-project.org/doc/qt-4.8/qstackedlayout.html 

