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,widt h=400)
frm.pack()
scrollbar1=Scro llbar(frm)
scrollbar2=Scro llbar(frm)
scrollbar1.pack (side=RIGHT,fil l=Y)
scrollbar2.pack (side=BOTTOM,fi ll=X)
listbox=Listbox (frm,width=400, height=400)
listbox.pack()
listbox.config( yscrollcommand= scrollbar1.set)
scrollbar1.conf ig(command=list box.yview)
listbox.config( xscrollcommand= scrollbar2.set)
scrollbar2.conf ig(command=list box.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 2919
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 HorizontalScrollbar = true. The text info in listbox
already beyond its right edge. How can I see the hidden part info in listbox?
here is a part of codes.
ListBox.ValueMember = XX
ListBox.DisplayMember = XXXX
|
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 Contract.
The subform listbox shows 21 rows.
That has been fine, but now we are starting to get some Contracts or
Estimates with more than 21 items.
|
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. How could I associate the
two controls to work as if they where only one?
Thank you for your help
Carmen
|
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 Anchor the listbox T, L, R, B on the parent form
The string items held within the listbox are quite big, much longer than
could be displayed within the Listbox display area.
|
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 {scrollbar-3dlight-color:aqua;
scrollbar-arrow-color:fuchsia;
scrollbar-base-color:fuchsia;
| |
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:
self.fonts=list(tkFont.families())
self.fonts.sort()
for item in self.fonts:
self.fontlist.insert(END, item) #self.fontlist is the
|
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 automatically if the
number of items in the ListBox exceed the height of the ListBox, the
horizontal scrollbar doesn't get displayed automatically when the text
of any of the items in the ListBox exceeds the width of the ListBox!
|
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 am wanting to draw my own non-client area (including the scrollbar).
I have had the following ideas but each idea has failed:
|
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. The majority of my items contain much
more than 10 characters and thus the reason for my use of owner drawn
listBoxes - I do not want to use a horizontal scrollbar, instead I want the
text of each item to wrap onto multiple lines. I do use a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |