By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,730 Members | 1,559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,730 IT Pros & Developers. It's quick & easy.

Why is the scroll bar just a fraction of the canvas? / Misplaced?

P: 1
Scroll bars, especially the vertical, are displayed at the end of the region. They appear to function well otherwise.
Code:

Expand|Select|Wrap|Line Numbers
  1. #test_scroll_bar_2_pack.py
  2. from tkinter import *
  3.  
  4. t = Tk()
  5.  
  6. c = Canvas(t)
  7. hsb = Scrollbar(t, orient="h", command=c.xview)
  8. vsb = Scrollbar(t, orient="v", command=c.yview)
  9. c.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
  10.  
  11. c.pack()
  12. hsb.pack(side=BOTTOM, fill=X)
  13. vsb.pack(side=RIGHT, fill=Y)
  14.  
  15. ###t.grid_rowconfigure(0, weight=1)
  16. ###t.grid_columnconfigure(0, weight=1)
  17.  
  18.  
  19. for x in range(100, 5000, 100):
  20.     for y in range(100, 5000, 100):
  21.         c.create_text((x,y), anchor=CENTER, text="%d,%d" % (x,y))
  22. c.configure(scrollregion = (0, 0, 5000, 5000))
  23.  
  24. t.mainloop()
1 Week Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.