How I can to part?



  • hi all,
    how i can to part my project to 4 frames Equal.
    and in one them to show a video for file i choose. like "open --> file".
    all project in python ind i using PyQt5

    tnx


  • Lifetime Qt Champion

    Hi
    Its a bit hard with the language. so im guessing a bit :)

    You mean split the mainwindow in 4 sections ?
    alt text

    You can use a Grid layout.



  • @mrjj said in how i can to part ..:

    Grid layout

    hi, i mean for what you did!
    can you send me to the code are do this in python?
    tnx!!


  • Lifetime Qt Champion

    @Dl10
    Hi
    I just did it Designer but not sure it works with python ?

    anyway, here is the c++ code.
    Sorry i never used python.

    // variables
        QWidget *centralWidget;
        QGridLayout *gridLayout;
        QFrame *frame;
        QFrame *frame_2;
        QFrame *frame_3;
        QFrame *frame_4;
    // create a Grid and put frames to it
            gridLayout = new QGridLayout(centralWidget);
            gridLayout->setSpacing(6);
            gridLayout->setContentsMargins(11, 11, 11, 11);
            gridLayout->setObjectName(QStringLiteral("gridLayout"));
    
            frame = new QFrame(centralWidget); // centralWidget is in MainWindow
            frame->setObjectName(QStringLiteral("frame"));
            frame->setFrameShape(QFrame::Box);
            frame->setFrameShadow(QFrame::Raised);
    
            gridLayout->addWidget(frame, 0, 0, 1, 1);
    
            frame_2 = new QFrame(centralWidget);
            frame_2->setObjectName(QStringLiteral("frame_2"));
            frame_2->setFrameShape(QFrame::Box);
            frame_2->setFrameShadow(QFrame::Raised);
    
            gridLayout->addWidget(frame_2, 0, 1, 1, 1);
    
            frame_3 = new QFrame(centralWidget);
            frame_3->setObjectName(QStringLiteral("frame_3"));
            frame_3->setFrameShape(QFrame::Box);
            frame_3->setFrameShadow(QFrame::Raised);
    
            gridLayout->addWidget(frame_3, 1, 0, 1, 1);
    
            frame_4 = new QFrame(centralWidget);
            frame_4->setObjectName(QStringLiteral("frame_4"));
            frame_4->setFrameShape(QFrame::Box);
            frame_4->setFrameShadow(QFrame::Raised);
    
            gridLayout->addWidget(frame_4, 1, 1, 1, 1);
    
    
    
    


  • are you know Designer for python? and i will did this.


  • Lifetime Qt Champion

    @Dl10

    Hi
    I think it exists

    https://www.youtube.com/watch?v=Dmo8eZG5I2w

    There you just place 4 qframes on center mainwindow
    Then right click (not on frames) and from layout menu
    select Grid layout


Log in to reply