Closed kencomputes closed 4 years ago
Hi @kencomputes - thanks for the feedback!
Currently there is no way to register a change event on toggle frames - but will be easy to add in to the next release.
When you create the ToggleFrame, it should be returned, so you can get at it that way:
with app.toggleFrame as tf:
tf.toggleButton ...
Or:
tf = app.startToggleFrame()
I'll get the meter documents updated so that they are clearer.
I think any widgets where text entry happens behave a bit strangely when it comes to their dimensions. I don't quite remember, but I think 71 may be something to do with the number of characters and perhaps the width of a character in the particular font...
I'll need to do some research and check back through the code...
@jarvisteach Thanks for the quick response! I think that being able to register callback events on a toggle frame's state change will be useful. For the meantime I've just registered an event loop to check for a few flags that I'm setting whenever I show/hide different widget frames in my UI.
Is there a method to check whether a widget or frame is hidden or visible? It's not a major issue since I can just set boolean flags whenever I show or hide something, but I imagine this could be a useful method in some cases.
Regarding the text entry widget widths, it looks like you're correct about the width value referring to the number of characters that can be displayed without scrolling. I just tested my directory entry field and it fits exactly 71 characters. Thanks for clarifying that for me!
This is in the next release.
Let me start by thanking you for all of the hard work that has been put into appJar! I've really been enjoying working with it so far.
I have been reading through the documentation and the source code and can't seem to figure out how to make my app's window size increase/decrease when a toggleFrame is toggled. This seems like it should be simple, but I can't seem to figure out a way to bind another callback function to my toggleFrame's button. I know I could register an event and constantly check the state of my frame with .getToggleFrameState and make adjustments based off of that, but that seems like overkill for my use case.
I read in pythonEvents about "Registering Other Event Types" with
app.getEntryWidget("widget_name").bind("<FocusOut>", function_name, add="+")
. I was trying to add something like.bind('<Button-1>', resizeWindow)
but I can't seem to figure out how to actually get my ToggleFrame object or its button so I can try binding an event to it. I also can't seem to find any functionality for checking whether or not a widget or frame is hidden. Does this exist?Any help with this would be much appreciated!
I also have a few notes regarding the documentation. I think it might be helpful to note that while getMeter() returns the value as a float between 0.0 and 1.0, setMeter() expects the value as an int or float between 0 and 100. This threw me off for a minute. It might also be helpful to note somewhere that the default window BG color is gray94 and perhaps add a link to the TK color constants.
Finally, under pythonWidgetOptions I think it would be helpful to provide more info regarding
.set XXX Width(name, value)
and.set XXX Height(name, value)
. I was trying to put some DirectoryEntry widgets into a ScrollPane. Through trial and error I landed on a width value of 71 to make my DirectoryEntry span the entirety of the ScrollPane, but I have no idea what that value is actually referring to (it doesn't appear to be a pixel or percentage value since the window width is 800px and the DirectoryEntry spans almost all of that).Again, thanks for all of the hard work that has gone into developing this library and thanks in advance for any help you can provide!
Version Information
appJar: 0.94.0 Python: 3.7.2 TCL: 8.6, TK: 8.6 Platform: Windows pid: 26464 locale: en_US