473,785 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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,se lectmode=SINGLE )
results.grid(ro w=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 3808
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,se lectmode=SINGLE )
results.grid(ro w=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
5337
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 program wants to write a new entry. This works OK, except that sometimes we want to copy out of piece of the contents and paste it in another window. When it's DISABLED, it appears that we can't even select a portion of the text. Is this an...
2
1716
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 I am running Python2.3.4 on winxp I haven't tried it on linux yet Any Ideas are appreciated Let me know if I am not being clear enough
2
5139
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 there may be better way. Zhang Le
2
6753
by: vm | last post by:
please help! I can't find anything wrong (except the result ofc ;-) This: picfile = 'logo.gif'
0
1426
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 then wanted to start putting some data into it. As you will see, the program is not yet finished but I post what I have so far.
32
7499
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. Naturally, I thought that I would use Tkinter as the GUI for these programs. However, in doing research into GUI development techniques, sample code, and showcase applications, what has struck me is how little sophisticated GUI development seems to be...
5
2037
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 the selected entry. Below the Entry boxes are two buttons, one that saves the changes to the database and the other is simply a Cancel button. Under Linux, both buttons appear correctly. However, in OS X the Cancel button is invisible unless...
2
1761
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 is a simple grid with labels in the left column and input widgets in the right column. One of the rows has a listbox in the right column. The listbox contains two items. I select one using widget.select_set(). The GUI is not complete yet,...
0
1315
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 = Tix.Tk() myAppGUIObject = myAppGUI(myRoot)
0
9645
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, 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...
0
9480
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,...
0
10330
Oralloy
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...
0
10153
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7500
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.