LINUX.ORG.RU

История изменений

Исправление rtxtxtrx, (текущая версия) :

Тебе ткинтер не нужен. Он уродлив. Делай сразу все на qml. Да и сама идея писать на питоне с tk сомнительна, так как tk имеет встроенный скриптовый язык tcl

main.qml

import QtQuick 2.15
import QtQuick.Controls 2.15

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: "Пример QML"

    SwipeView {
        id: swipeView
        anchors.fill: parent
        currentIndex: 0

        Page {
            Label {
                text: "Страница 1"
                anchors.centerIn: parent
            }
        }

        Page {
            Label {
                text: "Страница 2"
                anchors.centerIn: parent
            }
        }

        Page {
            Label {
                text: "Страница 3"
                anchors.centerIn: parent
            }
        }
    }

    PageIndicator {
        anchors.bottom: swipeView.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        count: swipeView.count
        currentIndex: swipeView.currentIndex
    }
}

main.py:

import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import QQmlApplicationEngine

if __name__ == "__main__":
    app = QGuiApplication(sys.argv)
    engine = QQmlApplicationEngine()
    engine.load(QUrl("main.qml"))

    if not engine.rootObjects():
        sys.exit(-1)

    sys.exit(app.exec_())

Исходная версия rtxtxtrx, :

тебе ткинтер не нужен. Он уродлив. Делай сразу все на qml. Да и сама идея писать на питоне с tk сомнительна, так как tk имеет встроенный скриптовый язык tcl