[Tutor] How to make clickable listbox from database by Tkinter
hi, i use python 2. how can i add a listbox under the entry and button widgets? i want to use database to fill the listbox, both fields in the database (English and Esperanto) listbox should be like this (words are beside eachother: *English* *Esperanto* waterakvo fatherpatro and so on... it's a dictionary app. i want to make the items in the list searchable, and when the user types and clicks on the button, it shows the word. files are attached. thanks a bunch, i'm a beginner in python! :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 136, Issue 27
let me put it this way: the listbox should be on the same frame under the entry widget and the whole list should be visible, when the user types the word in Entry widger and clicks on search button, the listbox narrows down to that word only and now just (for example: waterakvo) are visible. do you know what i mean? i'm not native english speaker so maybe i can't explain it :( the code and my database is in the file uploaded (the database is sqlite3 [i made it in ubuntu linux with SQLiteBrowser program]): http://qfs.mobi/f2361208 https://drive.google.com/file/d/0Bwe9iYyAhRzgT3hudnAxUkVzTTA/view?usp=sharing On Mon, Jun 15, 2015 at 2:30 PM, wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > >1. Re: python 3.4 documentation (Steven D'Aprano) >2. How to make clickable listbox from database by Tkinter > (Ali Moradi) >3. Re: How to make clickable listbox from database by Tkinter > (Alan Gauld) > > > -- > > Message: 1 > Date: Mon, 15 Jun 2015 13:49:44 +1000 > From: Steven D'Aprano > To: tutor@python.org > Subject: Re: [Tutor] python 3.4 documentation > Message-ID: <20150615034944.gc20...@ando.pearwood.info> > Content-Type: text/plain; charset=us-ascii > > On Sun, Jun 14, 2015 at 11:56:15AM -0700, Alex Kleider wrote: > > I'm using python 3.4 on an ubuntu 14.4 LTS OS and frequently find myself > > 'off line'. > > The Python interactive interpreter comes with a powerful interactive > help system. At the Python prompt, you can enter: > > help() > > help("keyword") # e.g. "raise" > > help(any_object) > > > to get help and documentation. > > > -- > Steve > > > -- > > Message: 2 > Date: Mon, 15 Jun 2015 11:41:37 +0430 > From: Ali Moradi > To: tutor@python.org > Subject: [Tutor] How to make clickable listbox from database by > Tkinter > Message-ID: > gtemz+dsl2fghnwfcpx3v8...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > hi, i use python 2. > > how can i add a listbox under the entry and button widgets? > > i want to use database to fill the listbox, both fields in the database > (English and Esperanto) > > listbox should be like this (words are beside eachother: > > *English* *Esperanto* > waterakvo > fatherpatro > > and so on... > > it's a dictionary app. > > i want to make the items in the list searchable, and when the user types > and clicks on the button, it shows the word. > > files are attached. > > thanks a bunch, i'm a beginner in python! :) > > > -- > > Message: 3 > Date: Mon, 15 Jun 2015 09:03:09 +0100 > From: Alan Gauld > To: tutor@python.org > Subject: Re: [Tutor] How to make clickable listbox from database by > Tkinter > Message-ID: > Content-Type: text/plain; charset=windows-1252; format=flowed > > On 15/06/15 08:11, Ali Moradi wrote: > > > how can i add a listbox under the entry and button widgets? > > Can you clarify that sentence? What do you mean by "under"? > Do you want the list box to be located on the same form as > two widgets but underneath? Or do you want the listbox > to appear when you press the button? > > If its the first then it will be down to using the > correct layout manager (pack, grid, place etc) in > conjunction with one or more Frame containers. > > If its the second the jn you will need to say where > the listbox should appear: in a dialog or on the > existing form. > > > i want to use database to fill the listbox, both fields in the database > > (English and Esperanto) > > What kind of database? You can attach Python to most databases > but there are differences depending on the exact database > you use. Is it SQL or a flat file database? > > > listbox should be like this (words are beside each other: > > > > *English* *Esperanto* > > waterakvo > > fatherpatro > > > > and so on... > > That's probably just a string formatting task. > &g
[Tutor] Clickable listbox in Tkinter python 2
let me put it this way: the listbox should be on the same frame under the entry widget and the whole list should be visible, when the user types the word in Entry widger and clicks on search button, the listbox narrows down to that word only and now just (for example: waterakvo) are visible. do you know what i mean? i'm not native english speaker so maybe i can't explain it :( the code and my database is in the file uploaded (the database is sqlite3 [i made it in ubuntu linux with SQLiteBrowser program]): http://qfs.mobi/f2361208 https://drive.google.com/file/d/0Bwe9iYyAhRzgT3hudnAxUkVzTTA/view?usp=sharing ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] clickable listbox from sqlite database.
Hi, you got what i mean thanks, your code (http://pastebin.com/VbaVKJgj) was so good. now i want to do two more things. i want to fill the listbox from my database which contains of one table (Words) and two fields (English) and (Esperanto), how can i do that? i want the program to be the same just the words loaded from my sqlite database. and second thing: i want to search the word when user hits "Enter" on keyboard, so user doesn't have to click on search button all the time! thanks a bunch. code: http://pastebin.com/VbaVKJgj ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] clickable listbox with Tkinter (python2)
Hi, i studied your book that u said before. now i came up with this code, which i can't now show my words in the list box! ? http://pastebin.com/GpWc8Pnw now, i've got a better idea! , i can use two lists like this code ( http://pastebin.com/sJj39UjA), just the items should be loaded from my database. like when i click water for example in the first list, the word akvo in the second list appears. now what is the method for filling the listbox from sqlite ? please modify the code for me becuz i'm beginner. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] How to show the listbox from sqlite and make it searchable?
hi, this is my code ( http://paste.pound-python.org/show/3DZoev97e1UkWFcATKYF/) how can i show the two fields name "esperanto" and "english" in a listbox positioned under the entry widget? i want the two fields to be beside eachother like (abak/o abacus) and i want to make them searchable via the entry widget like a dictionary app :) thanks, i'm beginner so please modify my code. and is there any good tutorial on using SQLite with tkinter and how to desplay records on GUIs ? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] You are right.
About the listbox from sqlite, yes you are right, i'm beginner in python, and i watched many videos and study books, but i can't write what i want to :(, i mean i know the python basics (like data structures and...), i know tkinter basics and how to write widgets, but i don't know how to relate widgets to my code:(, it is my biggest problem, and also i can't write OOP programs with classes and definitions, which is not good. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] About python intrepeters on Android.
Hi, i noticed that the Python intrepeters on Android OS does not have Tkinter! Why they couldn't bring Tkinter on Android too? It there anyway ti use tkintr on android too ? Tnx :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Clickable listbox opening specific .txt files
Hi, i want to open specific .txt files when each item on the listbox was clicked! When i click on the first item for example it opens 1.txt and shows it on the text widget on the right, and when i select the second item on the list first it erases the text on the Text widget and then opens 2.txt file and so on till item 17 on the list. Please modify my code i'm still beginner Thanks a lot paste.pound-python.org/show/uMUswu4YSmMY5XBPPgIy/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Clickable listbox opening .txt files
Hi, you said my click event grabs text and doesn't show it. So how do get it to show on the Text widget? So that when i clicked on item 1, 1.txt shows on the Text widget. I can't connect click event to Text widget from Tkinter import * root = Tk() root.title("Renkontoj kun Diferenculoj") root.iconbitmap(r"C:\python27\DLLs/py.ico") root.resizable(0, 0) frame1 = LabelFrame(root, height=300, width=400, text='Lecionoj') frame2 = LabelFrame(root, height=300, width=400, text='Tekstoj') frame1.grid(row=0, column=0) frame2.grid(row=0, column=1) def click(event): index = list.curselection()[0] file = open(r"C:\Users\deadmarshal\PycharmProjects\ali\1.txt").read() list = Listbox(frame1) list.insert(1, "Konatiĝu kun Kamila") list.insert(2, "Sinjoro Johano") list.insert(3, "Onklino Marta") scroll = Scrollbar(frame1, orient=VERTICAL, command=list.yview) scroll.grid(row=0, column=2, sticky='ns') list.grid(row=0, column=1) list.bind("", click) text = Text(frame2).grid() root.mainloop() ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Console application
Hi, i don't have any clue how to write a console program that shows a list of options which could be chosen with keyboard and when one item was selected, a text shows there. I want to know, which things i need to write a program like that? Input() , print, and What? :( ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] problem with python3 Tkinter scroll bar
Hi. i can't fix this error in my code about scroll bar. what should i do? i'm a beginner in Python plz help. https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] problem with scroll in Tkinter
https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/ On Fri, Jan 13, 2017 at 10:25 AM, Ali Moradi wrote: > hi. I've written this code and i can't fix the scrollbar error. i am a > beginner in Python plz help. this is python3 code. > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Searching db while typing on Entry widget
Hi. i want to search one field of my db while i type text in my Entry widget. how can i do that? and another problem is that now when i click on one of the item lists it always writes the first field of my db in the Text widget, i think i did the loop wrong maybe but i am not sure. #! /usr/bin/env python3 #GeologyDict by Ali M import sqlite3 as sqlite import tkinter as tk from tkinter import Text from tkinter import Entry from tkinter import Scrollbar from tkinter import ttk #GUI Widgets class GeologyDict: def __init__(self, master): master.title("EsperantoDict") master.resizable(False, False) master.configure(background='#EAFFCD') self.style = ttk.Style() self.style.configure("TFrame", background='#EAFFCD') self.style.configure("TButton", background='#EAFFCD') self.style.configure("TLabel", background='#EAFFCD') self.frame_header = ttk.Frame(master, relief=tk.FLAT) self.frame_header.pack(side=tk.TOP, padx=5, pady=5) self.logo = tk.PhotoImage(file=r'C:\Geologydict\eo.png') self.small_logo = self.logo.subsample(10, 10) ttk.Label(self.frame_header, image=self.small_logo).grid(row=0, column=0, stick="ne", padx=5, pady=5, rowspan=2) ttk.Label(self.frame_header, text='EsperantoDict', font=('Arial', 18, 'bold')).grid(row=0, column=1) self.frame_content = ttk.Frame(master) self.frame_content.pack() self.entry_search = ttk.Entry(self.frame_content) self.entry_search.grid(row=0, column=0) self.entry_search.insert(tk.END, "Type to Search") self.entry_search.bind('', self.entry_delete) self.button_search = ttk.Button(self.frame_content, text="Search") aks = tk.PhotoImage(file=r'C:\Geologydict\search.png') small_aks = aks.subsample(3, 3) self.button_search.config(image=small_aks, compound=tk.LEFT) self.button_search.grid(row=0, column=1, columnspan=2) self.listbox = tk.Listbox(self.frame_content, height=28) self.listbox.grid(row=1, column=0) self.scrollbar = ttk.Scrollbar(self.frame_content, orient=tk.VERTICAL, command=self.listbox.yview) self.scrollbar.grid(row=1, column=1, sticky='ns') self.listbox.config(yscrollcommand=self.scrollbar.set) self.listbox.bind('<>', self.enter_meaning) self.textbox = tk.Text(self.frame_content, width=60, height=27) self.textbox.grid(row=1, column=2) # SQLite self.db = sqlite.connect(r'C:\Geologydict\test.db') self.cur = self.db.cursor() self.cur.execute('SELECT Esperanto FROM words') for row in self.cur: self.listbox.insert(tk.END, row) # SQLite def enter_meaning(self, tag): if self.listbox.curselection(): self.cur.execute('SELECT English FROM words') for row in self.cur: self.cur.fetchall() self.textbox.insert(tk.END, row) def entry_delete(self, tag): self.entry_search.delete(0, tk.END) return None def main(): root = tk.Tk() geologydict = GeologyDict(root) root.mainloop() if __name__ == '__main__': main() ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] making a list in Tkinter with clickable items (Python 2.x)
Hi, i want to load a bunch of words from my database into the listbox in Tkinter, make them clickable, and when i clicked on them the specific meaning of that word apears in a textbox beside the listbox. i have a code but it's not complete. i'm a beginner in Python :( code: #!/bin/python from tkinter import * from tkinter import ttk def z(): global entry if(lb.get(lb.curselection())): txt.insert(END, lb.get(lb.curselection())) root = Tk() entry = ttk.Entry(root);entry.grid(row = 0, column = 0) lb = Listbox(root) a=lb.insert(1, "crime") b=lb.insert(2, "murder") lb.insert(3, "get") lb.insert(4, "take") Button(root, text="BUtt", command=z).grid() lb.grid(row = 1, column = 0) scroll = Scrollbar(root, orient = VERTICAL, command = lb.yview) scroll.grid(row = 0, column = 1, sticky = 'ns') lb.config(yscrollcommand = scroll.set) txt = Text(root, width = 60, height = 30,) txt.grid(row = 1, column = 2) root.mainloop() --- thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor