Making a scrollbar follow the last line in a list

Thread Solved

Join Date: Dec 2008
Posts: 13
Reputation: happymadman is an unknown quantity at this point 
Solved Threads: 0
happymadman happymadman is offline Offline
Newbie Poster

Making a scrollbar follow the last line in a list

 
0
  #1
Jun 22nd, 2009
So I have this simple list and scroll bar combo and I have been trying to make it stay at the bottom of the scroll bar as the text is added so it looks like the scroll bar is just to look back over the previous text.

Like in a text-based game style thing?

Here is la code:
  1. from Tkinter import *
  2.  
  3. root = Tk()
  4. displayscrollbar = Scrollbar(root)
  5. scrollbar.pack( side = RIGHT, fill=Y )
  6.  
  7. display = Listbox(root, yscrollcommand = scrollbar.set )
  8. for line in range(100):
  9. display.insert(END, "This is line number " + str(line))
  10. display.pack( side = LEFT, fill = BOTH )
  11. scrollbar.config( command = display.yview )
  12.  
  13. mainloop()
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 66
Reputation: kolosick.m188 is an unknown quantity at this point 
Solved Threads: 14
kolosick.m188's Avatar
kolosick.m188 kolosick.m188 is offline Offline
Junior Poster in Training

Re: Making a scrollbar follow the last line in a list

 
0
  #2
Jun 22nd, 2009
Add this line
display.see(display.size()) after
scrollbar.config( command = display.yview )
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 13
Reputation: happymadman is an unknown quantity at this point 
Solved Threads: 0
happymadman happymadman is offline Offline
Newbie Poster

Re: Making a scrollbar follow the last line in a list

 
0
  #3
Jun 22nd, 2009
Thanks a heap
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 13
Reputation: happymadman is an unknown quantity at this point 
Solved Threads: 0
happymadman happymadman is offline Offline
Newbie Poster

Re: Making a scrollbar follow the last line in a list

 
0
  #4
Jun 23rd, 2009
Sorry, Is there any chance you might know how to do it with a Text widget?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 66
Reputation: kolosick.m188 is an unknown quantity at this point 
Solved Threads: 14
kolosick.m188's Avatar
kolosick.m188 kolosick.m188 is offline Offline
Junior Poster in Training

Re: Making a scrollbar follow the last line in a list

 
0
  #5
Jun 24th, 2009
use: Text.see(Text.END) in the same place as last time
Last edited by kolosick.m188; Jun 24th, 2009 at 10:22 am.
There are 10 types of people in the world, those who get this, those who don't, and those who thought this was binary.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC