# Python, Qt .move() function or .setGeometry()

**URL:** <https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646>\
**Category:** Help\
**Tags:** wayland\
**Created:** [July 13, 2024, 9:14pm UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646 "2024-07-13T21:14:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Radek](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/radek/32/21235_2.png) [@Radek](https://discuss.kde.org/u/Radek)\
**Post date:** [July 13, 2024, 9:14pm UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/1 "2024-07-13T21:14:37Z")

</div>

Hi. Greetings to all.

I am using KDE on Fedora40. I am writing small programs with use of Python and PyQt5. In my old Fedora30 with old KDE with X11 was not a problem to open window at (x,y) by using Qt .move() function. Now I can’t. I found many information that case is happen because of Wayland. It developers left that possibility behind. Do you know some solution. Very odd but Tkinter has not that problem and also in Settings of KDE in “Windows rules” I can set ‘x’ an ‘y’ position of choosen window. How it is done?

Thanks for any help/answer  
Radek Glebicki

---

<div class="post-metadata">

**Author:** ![ulterno](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/ulterno/32/3999_2.png) [@ulterno](https://discuss.kde.org/u/ulterno)\
**Post date:** [July 14, 2024, 6:30am UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/2 "2024-07-14T06:30:33Z")

</div>

I had a similar problem a while back with QML.

Move or drag did not work. Instead, I just changed the x and y values of the root object, [similar to this](https://stackoverflow.com/questions/18927534/qtquick2-dragging-frameless-window). But this was all on an older system (and an older Qt version).

When you set stuff in window rules, you are essentially telling KWin directly, what to do (I haven’t read the code though). So, it’s not going to be a problem.

---

<div class="post-metadata">

**Author:** ![Duha](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/duha/32/32926_2.png) [@Duha](https://discuss.kde.org/u/Duha)\
**Post date:** [July 14, 2024, 5:28pm UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/3 "2024-07-14T17:28:55Z")

</div>

Yeah its a wayland thing.

> **[Window and Dialog Widgets | Qt Widgets 6.7.2](https://doc.qt.io/qt-6/application-windows.html#wayland-peculiarities)**
>
> Windows and Dialogs in Qt.

Only the compositor is allowed to do absolute positioning, that’s why window rules work.

What are you trying to achieve? Why do you want to position your window, and not let the compositor handle it for you?

---

<div class="post-metadata">

**Author:** ![Radek](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/radek/32/21235_2.png) [@Radek](https://discuss.kde.org/u/Radek)\
**Post date:** [July 14, 2024, 6:10pm UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/4 "2024-07-14T18:10:56Z")

</div>

I am writing my own toolbar to place on left edge in the middle. Middle position depends on amount of icons. So ‘y’ is not always that same. ☹ Now I am using ‘Windows rules’ but I have to correct that ‘y’.  
Small and stupid problem but still problem.

![obraz](https://discuss-cdn.kde.org/uploads/default/original/2X/7/7bb6d833b63c17a0f6b6d0edd7f7a7850c0c8934.png)

Radek Glebicki

---

<div class="post-metadata">

**Author:** ![ulterno](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/ulterno/32/3999_2.png) [@ulterno](https://discuss.kde.org/u/ulterno)\
**Post date:** [July 21, 2024, 3:07am UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/5 "2024-07-21T03:07:55Z")

</div>

Perhaps you can check out the code for the Panel and get some clues from that?

It seems to be able to do the centering thingy.

---

<div class="post-metadata">

**Author:** ![Radek](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/radek/32/21235_2.png) [@Radek](https://discuss.kde.org/u/Radek)\
**Post date:** [July 21, 2024, 5:57pm UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/6 "2024-07-21T17:57:07Z")

</div>

Please tell me what “Panel”. Some source in KDE?

Radek

---

<div class="post-metadata">

**Author:** ![ulterno](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/ulterno/32/3999_2.png) [@ulterno](https://discuss.kde.org/u/ulterno)\
**Post date:** [July 22, 2024, 7:52am UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/7 "2024-07-22T07:52:31Z")

</div>

I would expect it to be somewhere in either [plasma-desktop](https://invent.kde.org/plasma/plasma-desktop) or [plasma-workspace](https://invent.kde.org/plasma/plasma-workspace).

I at least found the `QML` part to be in `plasma-desktop/containments/panel/`, so perhaps you can start looking from there.

I am unable to be of much more use rn, but you might be able to find what you want if you look for how the floating, centered panel is implemented.

---

<div class="post-metadata">

**Author:** ![Radek](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/radek/32/21235_2.png) [@Radek](https://discuss.kde.org/u/Radek)\
**Post date:** [May 9, 2026, 4:44am UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/8 "2026-05-09T04:44:51Z")

</div>

Solution is to change kwinrulesrc in ~/.config/ for that python app with command:

`/usr/bin/kwriteconfig5 --file ~/.config/kwinrulesrc --group very-long-code-id --key position 0,{y}`

where {y} is new y position for app window. And after have to be call command:

`/usr/bin/qdbus org.kde.KWin /KWin reconfigure`

to refresh window position.

Radek Glebicki

---

<div class="post-metadata">

**Author:** ![ulterno](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/ulterno/32/3999_2.png) [@ulterno](https://discuss.kde.org/u/ulterno)\
**Post date:** [May 23, 2026, 5:21am UTC](https://discuss.kde.org/t/python-qt-move-function-or-setgeometry/18646/9 "2026-05-23T05:21:34Z")

</div>

Just for context, this seems to be the place where System Settings → Window Rules saved configuration lives and will also be editable using that dialog.
