GithubHelp home page GithubHelp logo

Window jump.. about kivywindowsize HOT 2 CLOSED

noembryo avatar noembryo commented on July 3, 2024
Window jump..

from kivywindowsize.

Comments (2)

ElliotGarbus avatar ElliotGarbus commented on July 3, 2024

You need to implement what is described. Perhaps I'll update this app to add that capability. Here is an example from another app I have written.
I create a file called configstartup.py and implement what is described above. Here is an example:

from configparser import ConfigParser
from kivy.config import Config
from kivy.utils import platform


"""
configstartup.py is used to set graphics 

This code must be at the top of the 'main' executable file.  
Config.set('graphics'...) are used to set the size of the main window.
Win10 requires the windows size to be set prior to App being loaded, to draw smoothly
 
"""
# Default window size and position, also used to set minimum window size in main.py
window_width = 1220
window_height = 660
window_top = 100
window_left = 100

if platform == 'win':
    import os
    ini_file = os.path.join(os.getcwd(), 'yourfile.ini')

    # Use Python lib configparser to read .ini file prior to app startup
    parser = ConfigParser()
    found = parser.read(ini_file)  # created in main.py: build_config()
    if found:
        Config.set('graphics', 'width', parser['Window']['width'])
        Config.set('graphics', 'height', parser['Window']['height'])
        Config.set('graphics', 'position', 'custom')
        Config.set('graphics', 'top', parser['Window']['top'])  # find top and left
        Config.set('graphics', 'left', parser['Window']['left'])
    else:
        Config.set('graphics', 'width', window_width)  # default value match default values in main.py: build_config, on_start
        Config.set('graphics', 'height', window_height)
        Config.set('graphics', 'position', 'custom')
        Config.set('graphics', 'top', window_top)
        Config.set('graphics', 'left', window_left)

Config.set('kivy', 'exit_on_escape', 0)
Config.set('input', 'mouse', 'mouse,disable_multitouch')

from kivywindowsize.

noembryo avatar noembryo commented on July 3, 2024

Well, thank you for the info.
It works.

    from kivy.config import Config
    Config.set("input", "mouse", "mouse,disable_multitouch")

    size = app_config.get("window size", (400, 600))
    pos = app_config.get("window pos", (50, 50))
    Config.set("graphics", "width", size[0])
    Config.set("graphics", "height", size[1])
    Config.set("graphics", "position", "custom")
    Config.set("graphics", "left", pos[0])
    Config.set("graphics", "top", pos[1])

I had the code ready.
I had tried this approach a couple of years ago, and although it seems to be working, it did not let you resize the windows (or something else equally unwanted).
Our great devs must have fixed it ...

EDIT: Confirmed.
It was not working in kivy 1.9 (when trying to resize the window, it jumped to the initial position set in the Config.
Fixed with 1.10!

from kivywindowsize.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.