473,418 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

[Tkinter] Listbox only takes one column

Hello,

I have a little problem using Tkinter:
I'd like to make a interface with 3 labels on the left, facing with 3 Entry
on the right, a button below Entrys, and a Listbox under all. I could place
the Labels and Entrys, but the Listbox is just in column 0, and I want it to
take all the width (column 0 + column 1)

here is the code:
#########################
from Tkinter import *

root=Tk()

Label(root, text="Artist :").grid(row=0, column=0)
Label(root, text="Title :").grid(row=1, column=0)
Label(root, text="Album :").grid(row=2, column=0)
Label(root, text="Results :").grid(row=4, column=0)
results = Listbox(root,selectmode=SINGLE)
results.grid(row=5, column=0)
artist = Entry(root)
title = Entry(root)
album = Entry(root)

artist.grid(row=0, column=1)
title.grid(row=1, column=1)
album.grid(row=2, column=1)
but= Button(root, text="Find")
but.grid(row=3, column=1)

root.mainloop()

###############################

How can I do?

Thank you.

Jul 18 '05 #1
2 3789
Nicolas Favre-Félix wrote:
Hello,

I have a little problem using Tkinter:
I'd like to make a interface with 3 labels on the left, facing with 3
Entry on the right, a button below Entrys, and a Listbox under all. I
could place the Labels and Entrys, but the Listbox is just in column 0,
and I want it to take all the width (column 0 + column 1)

here is the code:
#########################
from Tkinter import *

root=Tk()

Label(root, text="Artist :").grid(row=0, column=0)
Label(root, text="Title :").grid(row=1, column=0)
Label(root, text="Album :").grid(row=2, column=0)
Label(root, text="Results :").grid(row=4, column=0)
results = Listbox(root,selectmode=SINGLE)
results.grid(row=5, column=0, columnspan=2)
artist = Entry(root)
title = Entry(root)
album = Entry(root)

artist.grid(row=0, column=1)
title.grid(row=1, column=1)
album.grid(row=2, column=1)
but= Button(root, text="Find")
but.grid(row=3, column=1)

root.mainloop()

###############################

How can I do?

Thank you.


Just modify results.grid() as shown above. There is also a similar rowspan
option available, just in case...

Peter
Jul 18 '05 #2
Thank you Peter.


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the...
2
by: Maboroshi | last post by:
Why when I use the sticky command with the grid layout manager won't my Listbox expand it stays in the center maybe I am missing something but from every tutorial I see it says to do it this way ...
2
by: Zhang Le | last post by:
Hello, Is there a quick way to replace the content of a single item in tkinter's listbox? Currently my solution is to first delete the item, then insert a new item at the same position. I think...
2
by: vm | last post by:
please help! I can't find anything wrong (except the result ofc ;-) This: picfile = 'logo.gif'
0
by: Svenn Bjerkem | last post by:
Hi, Armed with Programming Python 3rd Edition and Learning Python 2nd edition I try to write an application which I at first thought was simple, at least until I was finished with the GUI and...
32
by: Kevin Walzer | last post by:
I'm a Tcl/Tk developer who has been working, slowly, at learning Python, in part because Python has better support for certain kinds of applications that I want to develop than Tcl/Tk does....
5
by: crystalattice | last post by:
I'm creating a shelve interface using Tkinter. I have a button that allows the user to modify an existing entry; when the button is clicked, a new TopLevel window appears with Entry boxes holding...
2
by: Ben Collver | last post by:
I am using Darwin 10.4.9, tcl 8.4.7, tk 8.4, and python 2.3.5. I have also tried Python 2.5 on Darwin, Debian, and Fedora Core 6. I am working on a GUI front-end to a Python program of mine. It...
0
by: dudeja.rajat | last post by:
On Mon, Aug 25, 2008 at 12:57 PM, <dudeja.rajat@gmail.comwrote: Ok...now I found the way to do that. But I'm stuck further. my code is as below: main module ********************** myRoot...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.