jarvisteach / appJar

Simple Tkinter GUIs in Python

Home Page:http://appJar.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subwindows and Main Window don't match

jeffkitson-music opened this issue · comments

Bug Report


If main window boilerplate code is applied to subwindows, the result is not the same.

Context


In creating subwindows, it is more difficult to create a clean look, because if the boilerplate code from the main window is applied to the subwindow the result is not the same.

This reminds me of WYSIWYG - What you code is what you (should) see.

Expected Behaviour


Code on the main window should produce the same result in subwindows.

Actual Behaviour


  • Subwindow is smaller,

  • label color is not stretchy,

  • and buttons not padded/spaced as on the main window.

appjar_window_compare

Sample code, demonstrating the issue


from appJar import gui

def press():
    print("User:", app.entry("Username"), "Pass:", app.entry("Password"))
    app.showSubWindow("Window2")

with gui("Login Window", "400x200", bg='orange', font={'size':18}) as app:
    app.label("Welcome to appJar", bg='blue', fg='orange')
    app.entry("Username", label=True, focus=True)
    app.entry("Password", label=True, secret=True)
    app.buttons(["Submit", "Cancel"], [press, app.stop])

    with app.subWindow("Window2", "Window2", "400x200", bg='orange', font={'size': 18}):
        app.setSize(400, 200)
        app.label("Welcome to appJar2", bg='blue', fg='orange')
        app.entry("Username2", label=True, focus=True)
        app.entry("Password2", label=True, secret=True)
        app.buttons(["Submit2", "Cancel2"], [press, app.stop])

Version Information


I am running the most current version. 0.94.0

Personal Note


I love appjar, and this is in no way a criticism. I'm only wondering why code on one window does not work on subsequent windows..

Try to customize Grid Layout for buttons and size of window. Maybe there is parameter for label. All of this you can find on appJar website.

Thanks for your reply! I have successfully solved the problem in my own scripts with grid layout, etc. I submitted the report because new programmers may find the above frustrating when starting a new project - "Why does this look great on the main window but not on the subwindows?"

What I'm saying is this is not a problem that should have to be figured out without either a fix or further explicit instructions in boilerplate code.

@jeffkitson-music thanks for raising this and @fullmacht thanks for trying to help.

You're right, sub windows don't behave the same as the main window. This is left over from the early days, when subWindows were intended for something slightly different. I was sure I had a section in the documents mentioning this, but having just looked through, I couldn't find it...

Ultimately, they've been configured to have a different default layout (for reasons I can barely remember) - it is possible to change the layout (as it sounds you've worked out) but that's a faff, especially for beginners.

I think the docs need updating to make this more obvious, and perhaps a flag could be introduced, to allow you to easily match the main GU layout.