Tkinter have a listbox list with checkbox and icon

Post here if you need help with creating a Graphical User Interface in Python.

Tkinter have a listbox list with checkbox and icon

Postby tbaror » Thu Jul 25, 2013 7:54 pm

Hello All,
I am trying to create a listbox using tkinter but the list should be with checkbox each item and icon at the head of selection.

Any idea how to add such attribute

Please advice
Thanks

Code: Select all
from tkinter import *
import tkMessageBox
import Tkinter

top = Tk()

Lb1 = Listbox(top)
Lb1.insert(1, "item 1")
Lb1.insert(2, "item 2")
Lb1.insert(3, "item 3")
Lb1.insert(4, "item 4")
Lb1.insert(5, "item 5")
Lb1.insert(6, "item 6")

Lb1.pack()
top.mainloop()
tbaror
 
Posts: 13
Joined: Sun Jul 07, 2013 8:06 pm

Re: Tkinter have a listbox list with checkbox and icon

Postby metulburr » Thu Jul 25, 2013 8:07 pm

the list should be with checkbox each item and icon at the head of selection.

this makes no sense, at least to me. You must at least know enough english to communicate properly.

tkinter is python3.x, Tkinter is python2.x. You are going to get an error either way by the first few lines.
Code: Select all
from tkinter import *
import tkMessageBox
import Tkinter as tk


tkMessageBox is python2.x and in 3.x is tkinter.messagebox
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1510
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Tkinter have a listbox list with checkbox and icon

Postby Yoriz » Thu Jul 25, 2013 8:23 pm

Tkinter only has a limited set of widgets available , it might not be able to do what you want.
You might have to go for one of the bigger python gui frameworks that has more widgets available by default.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Image
User avatar
Yoriz
 
Posts: 1046
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: Tkinter have a listbox list with checkbox and icon

Postby metulburr » Thu Jul 25, 2013 10:24 pm

oh after reading that a few times i think i get what he means. an image on the left with a check button on the right inside of each indexes of a listbox?

Yeah i dont think tkinter has any way to do that by default at least. You could of course create your own widgets. Make a rectangle, color change by mouse over rectangle, clickable, with an image on he left, and a checkbutton to the right, and text where ever you want it.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1510
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Tkinter have a listbox list with checkbox and icon

Postby tbaror » Fri Jul 26, 2013 5:33 am

Thanks all
cheers
tbaror
 
Posts: 13
Joined: Sun Jul 07, 2013 8:06 pm


Return to GUI

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests