Tkinter Scrolling Issues










1















I am trying to put a scrollbar on my listbox but because the items I am inserting are so long, but the scrollbar does not scroll all the way. If you run the code below, you will see what I am talking about and notice that the horizontal scroll bar can not scroll all the way to the right. Does anyone know how I can fix this? Same problem occurs for the vertical scroll bar when you add a few more entries.



import tkinter

lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
master = tkinter.Tk()
master.geometry("400x250")
frame = tkinter.Frame(master, borderwidth=1, highlightthickness=1,
highlightbackground="black", highlightcolor="black")
frame.place(bordermode=tkinter.INSIDE, height=240, width=300, y=0, x=30)
LIST = tkinter.Listbox(frame)
LIST.place(bordermode=tkinter.INSIDE, height=237, width=296)

Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
Scroll_Bar_x.config(command=LIST.xview)
Scroll_Bar_x.pack(fill=tkinter.X, side=tkinter.BOTTOM)
LIST.config(xscrollcommand=Scroll_Bar_x.set)
Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
Scroll_Bar_y.config(command=LIST.yview)
Scroll_Bar_y.pack(fill=tkinter.Y, side=tkinter.RIGHT)
LIST.config(yscrollcommand=Scroll_Bar_y.set)
for x in lista:
LIST.insert(0, x)

master.mainloop()









share|improve this question
























  • Your scrollbars are overlapping the text in the listbox.

    – Mike - SMT
    Nov 13 '18 at 20:05















1















I am trying to put a scrollbar on my listbox but because the items I am inserting are so long, but the scrollbar does not scroll all the way. If you run the code below, you will see what I am talking about and notice that the horizontal scroll bar can not scroll all the way to the right. Does anyone know how I can fix this? Same problem occurs for the vertical scroll bar when you add a few more entries.



import tkinter

lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
master = tkinter.Tk()
master.geometry("400x250")
frame = tkinter.Frame(master, borderwidth=1, highlightthickness=1,
highlightbackground="black", highlightcolor="black")
frame.place(bordermode=tkinter.INSIDE, height=240, width=300, y=0, x=30)
LIST = tkinter.Listbox(frame)
LIST.place(bordermode=tkinter.INSIDE, height=237, width=296)

Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
Scroll_Bar_x.config(command=LIST.xview)
Scroll_Bar_x.pack(fill=tkinter.X, side=tkinter.BOTTOM)
LIST.config(xscrollcommand=Scroll_Bar_x.set)
Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
Scroll_Bar_y.config(command=LIST.yview)
Scroll_Bar_y.pack(fill=tkinter.Y, side=tkinter.RIGHT)
LIST.config(yscrollcommand=Scroll_Bar_y.set)
for x in lista:
LIST.insert(0, x)

master.mainloop()









share|improve this question
























  • Your scrollbars are overlapping the text in the listbox.

    – Mike - SMT
    Nov 13 '18 at 20:05













1












1








1








I am trying to put a scrollbar on my listbox but because the items I am inserting are so long, but the scrollbar does not scroll all the way. If you run the code below, you will see what I am talking about and notice that the horizontal scroll bar can not scroll all the way to the right. Does anyone know how I can fix this? Same problem occurs for the vertical scroll bar when you add a few more entries.



import tkinter

lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
master = tkinter.Tk()
master.geometry("400x250")
frame = tkinter.Frame(master, borderwidth=1, highlightthickness=1,
highlightbackground="black", highlightcolor="black")
frame.place(bordermode=tkinter.INSIDE, height=240, width=300, y=0, x=30)
LIST = tkinter.Listbox(frame)
LIST.place(bordermode=tkinter.INSIDE, height=237, width=296)

Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
Scroll_Bar_x.config(command=LIST.xview)
Scroll_Bar_x.pack(fill=tkinter.X, side=tkinter.BOTTOM)
LIST.config(xscrollcommand=Scroll_Bar_x.set)
Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
Scroll_Bar_y.config(command=LIST.yview)
Scroll_Bar_y.pack(fill=tkinter.Y, side=tkinter.RIGHT)
LIST.config(yscrollcommand=Scroll_Bar_y.set)
for x in lista:
LIST.insert(0, x)

master.mainloop()









share|improve this question
















I am trying to put a scrollbar on my listbox but because the items I am inserting are so long, but the scrollbar does not scroll all the way. If you run the code below, you will see what I am talking about and notice that the horizontal scroll bar can not scroll all the way to the right. Does anyone know how I can fix this? Same problem occurs for the vertical scroll bar when you add a few more entries.



import tkinter

lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
master = tkinter.Tk()
master.geometry("400x250")
frame = tkinter.Frame(master, borderwidth=1, highlightthickness=1,
highlightbackground="black", highlightcolor="black")
frame.place(bordermode=tkinter.INSIDE, height=240, width=300, y=0, x=30)
LIST = tkinter.Listbox(frame)
LIST.place(bordermode=tkinter.INSIDE, height=237, width=296)

Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
Scroll_Bar_x.config(command=LIST.xview)
Scroll_Bar_x.pack(fill=tkinter.X, side=tkinter.BOTTOM)
LIST.config(xscrollcommand=Scroll_Bar_x.set)
Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
Scroll_Bar_y.config(command=LIST.yview)
Scroll_Bar_y.pack(fill=tkinter.Y, side=tkinter.RIGHT)
LIST.config(yscrollcommand=Scroll_Bar_y.set)
for x in lista:
LIST.insert(0, x)

master.mainloop()






python tkinter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 20:00







S.McWhorter

















asked Nov 13 '18 at 19:54









S.McWhorterS.McWhorter

818




818












  • Your scrollbars are overlapping the text in the listbox.

    – Mike - SMT
    Nov 13 '18 at 20:05

















  • Your scrollbars are overlapping the text in the listbox.

    – Mike - SMT
    Nov 13 '18 at 20:05
















Your scrollbars are overlapping the text in the listbox.

– Mike - SMT
Nov 13 '18 at 20:05





Your scrollbars are overlapping the text in the listbox.

– Mike - SMT
Nov 13 '18 at 20:05












1 Answer
1






active

oldest

votes


















2














You are having issues with overlapping your scroll bars on the placed listbox. Most of the time place() is not what you want to use.



Instead try grid() this will help keep everything in order and sized correctly.



import tkinter

lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
master = tkinter.Tk()
master.geometry("400x250")
frame = tkinter.Frame(master, height=240, width=300, borderwidth=1, highlightthickness=1, highlightbackground="black", highlightcolor="black")
frame.grid(row=0, column=0)
frame.rowconfigure(0, weight=1)
frame.columnconfigure(0, weight=1)
LIST = tkinter.Listbox(frame)
LIST.grid(row=0, column=0, sticky="nsew")
frame.grid_propagate(False)

Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
Scroll_Bar_x.config(command=LIST.xview)
Scroll_Bar_x.grid(row=1, column=0, sticky="ew")
LIST.config(xscrollcommand=Scroll_Bar_x.set)
Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
Scroll_Bar_y.config(command=LIST.yview)
Scroll_Bar_y.grid(row=0, column=1, sticky="ns")
LIST.config(yscrollcommand=Scroll_Bar_y.set)
for x in lista:
LIST.insert(0, x)

master.mainloop()


Results:



enter image description here






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288539%2ftkinter-scrolling-issues%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    You are having issues with overlapping your scroll bars on the placed listbox. Most of the time place() is not what you want to use.



    Instead try grid() this will help keep everything in order and sized correctly.



    import tkinter

    lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
    33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
    5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
    master = tkinter.Tk()
    master.geometry("400x250")
    frame = tkinter.Frame(master, height=240, width=300, borderwidth=1, highlightthickness=1, highlightbackground="black", highlightcolor="black")
    frame.grid(row=0, column=0)
    frame.rowconfigure(0, weight=1)
    frame.columnconfigure(0, weight=1)
    LIST = tkinter.Listbox(frame)
    LIST.grid(row=0, column=0, sticky="nsew")
    frame.grid_propagate(False)

    Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
    Scroll_Bar_x.config(command=LIST.xview)
    Scroll_Bar_x.grid(row=1, column=0, sticky="ew")
    LIST.config(xscrollcommand=Scroll_Bar_x.set)
    Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
    Scroll_Bar_y.config(command=LIST.yview)
    Scroll_Bar_y.grid(row=0, column=1, sticky="ns")
    LIST.config(yscrollcommand=Scroll_Bar_y.set)
    for x in lista:
    LIST.insert(0, x)

    master.mainloop()


    Results:



    enter image description here






    share|improve this answer



























      2














      You are having issues with overlapping your scroll bars on the placed listbox. Most of the time place() is not what you want to use.



      Instead try grid() this will help keep everything in order and sized correctly.



      import tkinter

      lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
      33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
      5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
      master = tkinter.Tk()
      master.geometry("400x250")
      frame = tkinter.Frame(master, height=240, width=300, borderwidth=1, highlightthickness=1, highlightbackground="black", highlightcolor="black")
      frame.grid(row=0, column=0)
      frame.rowconfigure(0, weight=1)
      frame.columnconfigure(0, weight=1)
      LIST = tkinter.Listbox(frame)
      LIST.grid(row=0, column=0, sticky="nsew")
      frame.grid_propagate(False)

      Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
      Scroll_Bar_x.config(command=LIST.xview)
      Scroll_Bar_x.grid(row=1, column=0, sticky="ew")
      LIST.config(xscrollcommand=Scroll_Bar_x.set)
      Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
      Scroll_Bar_y.config(command=LIST.yview)
      Scroll_Bar_y.grid(row=0, column=1, sticky="ns")
      LIST.config(yscrollcommand=Scroll_Bar_y.set)
      for x in lista:
      LIST.insert(0, x)

      master.mainloop()


      Results:



      enter image description here






      share|improve this answer

























        2












        2








        2







        You are having issues with overlapping your scroll bars on the placed listbox. Most of the time place() is not what you want to use.



        Instead try grid() this will help keep everything in order and sized correctly.



        import tkinter

        lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
        33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
        5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
        master = tkinter.Tk()
        master.geometry("400x250")
        frame = tkinter.Frame(master, height=240, width=300, borderwidth=1, highlightthickness=1, highlightbackground="black", highlightcolor="black")
        frame.grid(row=0, column=0)
        frame.rowconfigure(0, weight=1)
        frame.columnconfigure(0, weight=1)
        LIST = tkinter.Listbox(frame)
        LIST.grid(row=0, column=0, sticky="nsew")
        frame.grid_propagate(False)

        Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
        Scroll_Bar_x.config(command=LIST.xview)
        Scroll_Bar_x.grid(row=1, column=0, sticky="ew")
        LIST.config(xscrollcommand=Scroll_Bar_x.set)
        Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
        Scroll_Bar_y.config(command=LIST.yview)
        Scroll_Bar_y.grid(row=0, column=1, sticky="ns")
        LIST.config(yscrollcommand=Scroll_Bar_y.set)
        for x in lista:
        LIST.insert(0, x)

        master.mainloop()


        Results:



        enter image description here






        share|improve this answer













        You are having issues with overlapping your scroll bars on the placed listbox. Most of the time place() is not what you want to use.



        Instead try grid() this will help keep everything in order and sized correctly.



        import tkinter

        lista=[11111111111111111111111111111111111111111111111,22222222222222222222222222222222222222222222222222,
        33333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444467,4444444444444444,
        5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555556]
        master = tkinter.Tk()
        master.geometry("400x250")
        frame = tkinter.Frame(master, height=240, width=300, borderwidth=1, highlightthickness=1, highlightbackground="black", highlightcolor="black")
        frame.grid(row=0, column=0)
        frame.rowconfigure(0, weight=1)
        frame.columnconfigure(0, weight=1)
        LIST = tkinter.Listbox(frame)
        LIST.grid(row=0, column=0, sticky="nsew")
        frame.grid_propagate(False)

        Scroll_Bar_x = tkinter.Scrollbar(frame, orient=tkinter.HORIZONTAL)
        Scroll_Bar_x.config(command=LIST.xview)
        Scroll_Bar_x.grid(row=1, column=0, sticky="ew")
        LIST.config(xscrollcommand=Scroll_Bar_x.set)
        Scroll_Bar_y = tkinter.Scrollbar(frame, orient=tkinter.VERTICAL)
        Scroll_Bar_y.config(command=LIST.yview)
        Scroll_Bar_y.grid(row=0, column=1, sticky="ns")
        LIST.config(yscrollcommand=Scroll_Bar_y.set)
        for x in lista:
        LIST.insert(0, x)

        master.mainloop()


        Results:



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 20:11









        Mike - SMTMike - SMT

        9,58021434




        9,58021434





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288539%2ftkinter-scrolling-issues%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo