sciter-sdk / pysciter

Python bindings for Sciter
https://sciter.com
MIT License
396 stars 40 forks source link

Setting position after size changes size of window #27

Closed martinlombana closed 3 years ago

martinlombana commented 3 years ago

When the position value exceeds the value of the set frame size, the window will over-resize (with a regular html, with no other props values attatched to the html element). Maybe I am not using the right value, or "pos" is not intended for that use. I tried looking for the init values in the original docs (not python), but I didn't find that particular value. Maybe if you can point me to the docs, in case I assumed something which is not right, it would be appreciated. As a side note, I have 2 monitors (I don't know if that affects in this use case).

Thanks!

import sciter
from sciter import SCITER_RT_OPTIONS

class RootEventHandler(sciter.EventHandler):
    def __init__(self, el, frame):
        super().__init__(element=el)
        self.parent = frame
        pass

    def on_event(self, source, target, code, phase, reason):
        he = sciter.Element(source)
        pass

class Frame(sciter.Window):

    def __init__(self):
        super().__init__(ismain=True, uni_theme=True, debug=False, size=(600, 500), pos=(1200, 300), resizeable=False)
        self.set_dispatch_options(enable=True, require_attribute=False)
        pass

if __name__ == "__main__":
    print("Sciter version:", sciter.version(as_str=True))
    sciter.set_option(SCITER_RT_OPTIONS.SCITER_SET_DEBUG_MODE, True)
    frame = Frame()
    frame.setup_debug()
    frame.load_file("index.html")

    frame.run_app()
pravic commented 3 years ago

Thanks for the catch (and for the example to look at!). There was a miscalculation of the window rectangle.

martinlombana commented 3 years ago

Thanks to you for the quick fix!