jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
615 stars 68 forks source link

Widget doesn't align. #589

Closed rixchy closed 4 years ago

rixchy commented 5 years ago

Bug Report

I am having an issue, where my "emptyLabel" does NOT align like it should. I set it on row 0 and column 1, tho it's in the center.

Context


I am trying to create a calculator in appJar tho I am a beginner. If there is some pretty dumb errors I have made there, then I apologize in advance.

Expected Behaviour


I expect it to align it at the top.

Actual Behaviour


Aligns in center.

Any error messages produced by appJar


Nope, not any errors.

Sample code, demonstrating the issue


from appJar import gui

app=gui("AppJar Calculator", "400x300")
app.setResizable(False)

app.addEmptyLabel("res", 0,1)
app.setLabelBg("res", "white")

app.go()

What steps are needed to reproduce the bug


I am new to GitHub too, so I don't exactly know what "bug reproducing" means, sorry.

Version Information


For some reason, it shows that "appJar" module isn't found...

Crivella commented 5 years ago

For what I've found grid aligning is somewhat tricky. They way i managed to workaround this is to add an empty placeholder so that appJar will actually create an extracolumn.

app.addEmptyLabel('Filler', 0,0)

I sincerely don't know if this is the intended behavior, you might want to wait for a response from the developer of the package. In more complex cases you also might need to use frames to actually get the alignment you want (I found that if you want two object on the same grid column to have different size/behavior, you might actually need to place one inside a frame).

projectbtle commented 4 years ago

Can you try adding the following line before you add the label: app.setSticky("n")

This is supposed to make the widgets "stick" to the north of the grid-cell. Ref: http://appjar.info/pythonWidgetLayout/#widget-positioning

jarvisteach commented 4 years ago

The behaviour you describe is the "expected" behaviour..

Have a read here

Basically, you have to tell the rows/columns to stretch appropriately, and tell the widgets to stick to the relevant sides.

So, calling app.setSticky('news') will cause widgets to stick to all four sides (north, east, south, west). And calling app.setStretch('both') will ensure the grid is stretching to fill the entire space.