Scrolled Text Widget!! - Tkinter TTKBootstrap 22

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on guys John Elder here from tcantry.com and in this video we're going to look at the scroll text widget for ttk bootstrap and kinter all right guys like I said in this video we're going to look at the scrolled text widget but before we get started if you like this video you want to see more like it be sure to smash like button below subscribe to the channel give me a thumbs up for the YouTube algorithm and be sure to grab your totally free pdf version of my kinter widget quick reference guide book this thing is awesome over 150 pages with all the counter widget attributes grab your free copy today just head over to tcantor.com forward slash widget-book enter your email address and I'll send that right out to you and while you're there think about membership in tkinder.com and get all my Kindred courses on my future courses for one low price use coupon code YouTube to get 30 off membership if you're interested alright this is gonna be a very short video but a very cool video and that's because we're gonna look at the scrolled text widget and that is just what it sounds like a text widget that is built in with a scroll bar look at that right so in the past we had to create an actual scroll bar widget and add it to a text box or add it to a frame or add it to whatever in ttk bootstrap there's actually a widget built into it that has a scroll bar right there and you could do a couple cool things with it you could hide it you could show it you could have it you hover your mouse over it appears or doesn't appear very cool and very easy to use and that's what we're going to look at in this video so let's head over to our code I'm using the Sublime Text Editor and then get batch terminal as always and as always you can find a link to the code in the pin comment section below as well as link to the playlist with all the other videos in this ttk bootstrap Series so check that out if you haven't so far now I don't know 10 videos or go or so check the playlist I'll put a link up here I did a video on scroll bars with ttk bootstrap and you could use scroll bars in the normal way that you would with Kinder or you can if you're using a text widget you can just use this little trick I'm about to show you right now so I've got a file I'm calling it scroll underscore text Dot pi and we've got our basic ttk bootstrap starter code that we always have I've imported ttk bootstrap as TB we're using the superhero theme and everything else is pretty much rudimentary so to use this we actually have to import it first so let's go from ttk bootstrap dot scrolled we want to import scrolled text now you'll notice the S and the T and scrolled text are both capitalize everything here is lowercase so that's all we have to do we just have to import it now I know we imported pretty much everything here in ttk bootstrap as TB but we still have to for some reason import this guy as well so let's come down here and let's create a text box so text widget and I'm going to call this my underscore text and now normally this would be a TB dot you know text widget but not this time this time we're calling just straight up scrolled text and that's because we imported that right there right so we want to put this in root and now we can give this a height of let's say 20 and a width of like I don't know 110 and let's also give this a wrap of word this is basic text widget stuff we want our words to wrap completely we don't want to get to the end of the line in the text box and have a word get cut off mid word and have half the word on one line and the other half of the word on the other line below it we want to wrap the entire word down to the line below so there we go so really that's all we need so let's go underscore text Dot pack let's give this a pad why like I don't know 15 or so push down screen a little bit so let's head back over to our terminal and run this guy I mean my cetkinter.com directory and let's run python scroll underscore text fi and we have a typo as we of course need an equal to sign there okay so put an equal to sign come back clear the screen run this guy again all right and there we go boom you'll notice it doesn't appear now but if we start to type and you know we gotta get to the end and keep going you can see over there on the right it's adding the little scroll bar thing and we can scroll up and down and it is fantastic and that's all there is to it so there's one thing I want to show you about this in addition we can also give this an auto hide of true now by default Auto Hide is set to false as we just saw when we ran it the scroll bar was there even though we didn't even need it until we started typing text and then it kind of you know popped up or whatever if we set Auto Hide to True head back over here run this guy you'll notice there is no scroll bar at all until I hover over and then it kind of appears same deal if we start to type a bunch of stuff you'll notice the scroll bar isn't automatically showing up it's been hidden it's Auto Hide It Auto hide it it's Auto auto hide it and but if we move our Mouse over boom then it pops up and we can use it now some people might like that some people might not personally I I don't know I don't really care for that it seems a little confusing uh I want the scroll bar to just always be there so what I would do is leave that off or you could set this to Auto Hide equals false save this head back over here run this guy again and we're going to get just the default thing where the scroll bar is just already there always and as you kind of move down a little scrolly thing appears and uh very cool so what else can we do to this well we can use all of our boot Styles if we want boot Style and you've got all of the boot styles that we've been talking about throughout this series primary secondary info success danger light dark any other ones that I might have missed and probably want to spell boot style right and this won't change the text box itself but it will change the scroll bar color so if we head back over here and run this guy again now our scroll bar is red because that's the danger color right very cool and very neat now if we head over to the ttk bootstrap documentation at ttkbootstrap.read the docs.io and then click on API and let's see here if we scroll down here you can see there's a scrawled frame and a scrolled text if you click on scroll text you can see some code and some things here if you want to read more about this you can see you can add boot style you can also add padding you'll notice you can designate vertical or horizontal bars so you can have a v bar or an H bar the V bar is default we've just been looking at that but if you wanted to add an H Bar for a horizontal one you could do that let's head back over here and let's go H bar equals true and this just takes true or false it's Boolean so if we come back over here run this guy again see now we've got horizontal and vertical and if we scroll all the way over let's see now this one sort of appears and works very cool so that's the scroll text widget it's so much easier than creating a scroll bar and physically adding it to your text widget or to a frame or whatever very awesome very easy to use and that's all there is to it so that's all for this video if you liked it be sure to smash like button below subscribe to the channel give me a thumbs up for the YouTube algorithm and be sure to grab your totally free PDF copy of my kinter widget quick reference guidebook I think it's awesome over 150 pages with all the Canter widget attributes all spelled out grab your free copy today just head over to teakinter.com forward slash widget Dash book in your email address and I'll send that right out to you and while you're there thinking about membership in decanter.com and get all my Kindred courses all my future courses for one low price use coupon code YouTube to get 30 off membership if you're interested my name is John Elder from teakinter.com I'll see you in the next video
Info
Channel: Tkinter․com
Views: 3,491
Rating: undefined out of 5
Keywords: ttkbootstrap scrolled text, ttkbootstrap scrolledtext, ttkbootstrap scrolledtext widget, ttkbootstrap scrolled text widget, tkinter scrollbar, ttkbootstrap scrollbar, tkinter.com, john elder, john elder tkinter, john elder ttkbootstrap, john elder tkinter tutorial, john elder tkinter tutorial 22, john elder ttkbootstrap tutorial, john elder ttkbootstrap tutorial 22
Id: Z2gt28vryxo
Channel Id: undefined
Length: 7min 52sec (472 seconds)
Published: Tue May 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.