Hi,
Iam using Python 2.5 and developing an application using Tkinter.
I want a listbox with scrollbar. I tried to combine both
but it gets filled in the entire screen.
Here is the code..
frm=Frame(root,height=400,width=400)
frm.pack()
scrollbar1=Scrollbar(frm)
scrollbar2=Scrollbar(frm)
scrollbar1.pack(side=RIGHT,fill=Y)
scrollbar2.pack(side=BOTTOM,fill=X)
listbox=Listbox(frm,width=400,height=400)
listbox.pack()
listbox.config(yscrollcommand=scrollbar1.set)
scrollbar1.config(command=listbox.yview)
listbox.config(xscrollcommand=scrollbar2.set)
scrollbar2.config(command=listbox.xview)
How to position this scrollbar in a particular
position??Also is there any table widget
in Tkinter that i can use in windows. I think tktable widget
works only for linux..
Pls help
2 2894
It would help us all a great deal if you could use CODE tags around your code to make it easier to read.
Please read the posting guidelines before posting, particularly the "How the ask a question" section.
I prefer to use the PMW extension to Tkinter. PMW has a scrolled listbox widget. This is something I had lying around.
In answer to your question, TableList will run on any OS that has TCL/Tk installed http://www.nemethi.de/ - import Tkinter
-
import Pmw
-
class PMWListBox :
-
def __init__( self, list_in, min_width=300, min_height=350 ) :
-
self.top = Tkinter.Tk()
-
self.top.geometry( "300x300+10+10" )
-
self.top.minsize( min_width, min_height )
-
self.top.option_add('*Font', 'Fixed 14')
-
Pmw.initialise( fontScheme='default')
-
#--- exit button must be first----------------------
-
exit = Tkinter.Button(self.top, text='EXIT',
-
command=self.top.quit, bg='lightblue', fg='yellow' )
-
exit.pack(fill="x", expand=1, side="bottom")
-
#----------------------------------------------------------------
-
scroll_box = Pmw.ScrolledListBox( self.top, \
-
listbox_selectmode="SINGLE", \
-
items=(list_in) )
-
scroll_box.pack(fill="both", expand=1, padx=5, pady=5, side="top" )
-
self.top.mainloop()
-
##=======================================
-
if __name__ == "__main__" :
-
list_items=["First List Entry", "Second List Entry", \
-
"Third List Entry", \
-
"Fourth List Entry -- W I D E -- W I D E", \
-
"Fifth List Entry", "Sixth Entry", "Seventh Entry" \
-
"Eighth Entry", "Ninth Entry", "Tenth Entry", \
-
"Entry # 11 Test", "Test for 12th Lit", \
-
"Thirteen", "Fourteen", "Fifteen"]
-
PM = PMWListBox( list_items )
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Brian |
last post by:
Hi, All,
I'm using MS.net 2003 and using a windows.forms.listbox control for my
window application but I don't know why the Horizontal Scrollbar could NOT be
shown even if I set...
|
by: Alan Lane |
last post by:
Hello world:
I have a Parent form with a combobox, where the user selects a Contract or
Estimate number.
Then, on a subform, I have a listbox that gets filled with the details of
the selected...
|
by: carmen |
last post by:
I need to have in a form a listbox with a big scrollbar (I'm working for a
touchscreen). As the scrollbar that the listbox has is small, I put a
listbox withou scroll and a scrollbar independent....
|
by: Paul_Madden via DotNetMonster.com |
last post by:
I am handling the Listbox DrawItem event to enable the listbox strings to be
displayed in different colours for easy reading.
Have set ScrollAlwaysVisible and HorizontalScrollbar to true.
I...
|
by: kurt sune |
last post by:
How do I render the scrollbars by CSS in a listbox?
I have understood that an asp listbox gets rendered as a select element.
So I tried first by adding a style element:
..TA...
|
by: Kevin Walzer |
last post by:
I'm trying to set the active item in a Tkinter listbox to my
application's currently-defined default font.
Here's how I get the fonts loaded into the listbox:
...
|
by: rn5a |
last post by:
How do I make a ListBox display the horizontal scrollbar if the text of
any of the items in the ListBox exceeds the width of the ListBox?
Unlike the vertical scrollbar which gets displayed...
|
by: evan |
last post by:
Hi,
Is anyone able to give me an example on how to scroll the contents of
a ListBox without forcing the user to click on the scroll up/down
internal buttons?
==============================
I...
|
by: LostInMd |
last post by:
Hi All,
I've got an owner drawn listBox where I draw and measure the items that I add
to the listBox. For example, I have a listBox that can only display 10
characters on each horizontal line. ...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |