I was wondering if I can add a scrollbar to a Label or not?
I followed this tutorial to create a simple terminal GUI with a Button and a TextField. The problem is that, unlike what's in the tutorial , I need my Label to contain more than just a single line
Any alternatives? I want something exactly like this tutorial, but with more lines and a scrollbar for the Label (I already limited its size, but no scrollbar).
You cannot add a scrollbar to a Label.
If you want multiple lines of text that can be scrolled, use a Text widget.
Related
Iv'e tried a bunch of random things. I know I'm supposed to be specific when explaining this but I don't really know what to say. I made a scrollbar in a def function, it was in a whole new screen and I added it to a text box. So I'm wondering if I can just add my main scrollbar to the frame/screen in my main window. My previous scrollbar is in the recipe_steps function.
I am developing a UI that uses a Tkinter Listbox item to display a bunch of dynamically inserted frames that contain other labels. The Listbox works, but in turn it is displaying some weird indexes that I do not want to see in the window.
They look like this.
How can I disable these indexes from showing up?
This is the part of code that is responsible for initialising the Listbox
vertical_frame = Listbox(root)
vertical_frame.config(bg="#394144", bd=0, highlightthickness=0, height=10, selectmode=0,
activestyle="none", fg="#fff", exportselection=0)
Also, the frame is used in a function to be able to modify it's contents in a dynamic way.
The only thing I do there is
_frame.insert(END, temp_frame)
_frame.pack()
where _frame stands for vertical_frame, but it is passed to a function.
How can I disable the wierd numbers from showing up?
Those "weird indexes" are the string representation of widgets. To get them to not show up, you need to remove the code that is trying to insert a widget into a listbox. The listbox can only display text.
If you are trying to create a scrollable list of frames, you will need to either embed them in a canvas, or embed them in a text widget. Those are the two widgets that both support scrolling and the embedding of other widgets.
I need to create a message box for a user in a GUI with tkinter. For 3/4 of my entries, Entry(master, options. . .,) works. But for a message box, I need a multi line entry.
How would I do this? I tried ScrolledText(root).pack(), but it doesn't have the same commands/variables as Entry.
It is not explicitly mentioned in the documentation, but even if the tkinter.Entry widget's content can be scrolled, it can only be scrolled horizontally meaning that you can not use the yscrollcommandoption unlike with Canvas, Text and Listbox widgets.
This means technically your goal is not feasible, I mean you can not write multiple lines inside an Entry widget so that you scroll them vertically but only horizontally:
(if you need the code of this screenshot, please let me know).
Billal is right, however i would recomend simply using a Textbox.
go to: http://www.tutorialspoint.com/python/tk_text.htm
for more information
I am developing a wxPython GUI application where I need to create a Button label of big string - like "Change the Address"
The issue is that the button label does not gets wrapped and button size expands which is not the intention.
Is there any way we can wrap the button label around the button which is of specified size?
You shouldn't make buttons with long labels to begin with. Buttons are not supposed to have long labels. Use a TextCtrl or a StaticText instead.
However, if you really, really want to do this, try inserting line breaks into your strings. In Python, you would do this:
label= "Change the\n Address"
This works on Windows anyway with wxPython 2.9
I'm using python 2.7 and I'd like to have an GUI with a scrollable list where each item in the list has both an image and some text. I'd like these items to be selectable like in a ListBox. I've tried a couple things and it seems ListBox only accepts text?
What widget/combination of widgets should I use?
Try placing a whole bunch of buttons in a frame and assigning a scroll bar a to that frame and make it so when the user presses a button is changes colour or picture or something and then any button with that same colour of picture before will go back to normal. Also, and a tkinter variable with which button is active so you can reference it later.
I'm fairly sure you can use both texts and images in a button simultaneously, but if not you can just put a button and an image side by side in the same row on the frame
I recommend you make this entire scrolling object a class and keep references of everything inside within that class.
If you need any help doing this, just give me a shout.