0

I try to make scrolling on an Entry in python. when I run program nothing happen. Please any one help me??

this is my code:

self.scrollbar = tk.Scrollbar(self,orient="horizontal")
self.e3 =tk.Entry(self,xscrollcommand=self.scrollbar.set)
self.e3.focus()
self.e3.pack(side="bottom",fill="x")
#self.e3.grid(row=10, column=7)
self.scrollbar.pack(fill="x")
self.scrollbar.config(command=self.e3.xview)
self.e3.config()
user1926663
  • 1
  • 1
  • 1

1 Answers1

0

Your code works, just delete all "self". Word "self" is usually used in classes (can be replaced with anything, like "bananas"). Here you can find some explanation:

What is the purpose of self?

Working code:

import tkinter as tk
scrollbar = tk.Scrollbar(orient="horizontal")
e3 =tk.Entry(xscrollcommand=scrollbar.set)
e3.focus()
e3.pack(side="bottom",fill="x")
#e3.grid(row=10, column=7)
scrollbar.pack(fill="x")
scrollbar.config(command=e3.xview)
e3.config()

@EDIT: The last line (e3.config()) is unnecessary - it does nothing.

Community
  • 1
  • 1
Disconnect3d
  • 312
  • 1
  • 3
  • 11