Closed robertmlinden closed 4 years ago
Don't think it's exposed (yet)...
For now, you could try:
app.widgetManager.get(app.Widgets.PagedWindow, "title").posLabel.config(fg='colour')
Been playing around with this. The two labels (title & position) both use the fg
property.
So, if you configure the fg
of the widget, they should be changed:
with app.pagedWindow("Main Title", fg='red'):
Unfortunately, that property is inherited by all the pages, so they will have red text.
You can change that when you create each page:
with app.page(fg='black'):
But, that's not ideal.
Once the PagedWindow has been created, you can change the fg
property of the widget, and it won't be inherited by the pages:
with app.pagedWindow("Main Title", fg='red') as pw:
pw.config(fg='red')
But, again, this is kind of against the ethos of appJar.
Thank you! Anything helps.
with app.pagedWindow("Main Title", fg='red')
was sufficient for me.
I have a similar hitch that I don't want to open an issue about unnecessarily.
I'm building a PagedWindow layout, but I need finer control over the user's ability to traverse pages. I'd like to change the functions that the "Previous" and "Next" buttons hook to, not just the button text. I'd also need to be able to enable / disable them as needed, though I'd prefer to be able to show / hide them.
Any ideas?
Hi @backXslash - you're asking for a bit more than the PagedWindow supports.
You can't change the previous/next button functions, but you could add extra functions to call when those buttons are pressed. You can't hide/disabled them, but you can change their text.
However, you can very easily implement your own PagedWindow using a FrameStack.
Then you can set the change
parameter on the framestack, which will only let the user continue if it returns True:
from appJar import gui
def nav(btn):
if btn == "FIRST": app.firstFrame("Pages")
elif btn == "NEXT": app.nextFrame("Pages")
elif btn == "PREV": app.prevFrame("Pages")
elif btn == "LAST": app.lastFrame("Pages")
def verify():
# return False if you want to stop the user progressing
return True
with gui("My Paged Window", '300x500', labelFont=16, bg='black') as app:
with app.frameStack("Pages", start=0, change=verify):
for i in range(10):
with app.frame():
app.label(i, bg=app.RANDOM_COLOUR())
app.config(sticky='esw', stretch='column')
with app.frame('buttons'):
app.button('FIRST', nav, icon='arrow-1-backward', pos=(0, 0), tip='First')
app.button('PREV', nav, icon='arrow-1-left', pos=(0, 1), tip='Previous')
app.button('NEXT', nav, icon='arrow-1-right', pos=(0, 2), tip='Next')
app.button('LAST', nav, icon='arrow-1-forward', pos=(0, 3), tip='Last')
How can I change the black-boxed text color above?