Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
ZTE MF283U 4G Unlocked Router (Used)
ayanthamaxi
Updated:
Sunday at 8:26 PM
ලංකාවේ හොඳම උපකාරක පන්ති සහ ගුරුවරුන් එකම තැනකින් - TopTuition.lk
dulithapathum
Updated:
Jul 18, 2026
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Jul 15, 2026
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Jul 15, 2026
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Jul 15, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Python (tkinter/GUI) වැඩ්ඩො
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="0x9" data-source="post: 27191914" data-attributes="member: 528773"><p>python ගැන නම් ලොකුවට දන්නේ නෑ, string එකකට වඩා queue එකක් use කරොත් වැඩේ ලේසි වෙයි නේද?</p><p></p><p>[ATTACH=full]154350[/ATTACH]</p><p></p><p>modified code එක </p><p></p><p>updater.py</p><p></p><p>[CODE=python]</p><p>from tkinter import *</p><p>import threading, queue</p><p>import GUI as sf</p><p>c = threading.Condition()</p><p></p><p>def popupmsg(q):</p><p> root = Tk()</p><p> window = sf.Window(root,q)</p><p> window.main()</p><p></p><p>q = queue.Queue()</p><p>t = threading.Thread(target=popupmsg,args=(q,))</p><p>t.start()</p><p>data = ["apple", "banana", "cherry"]</p><p>for x in data:</p><p> q.put(x)</p><p>[/CODE]</p><p></p><p></p><p>GUI.py</p><p></p><p>[CODE=python]</p><p>from tkinter import *</p><p>import time</p><p>import threading</p><p></p><p># def main():</p><p># root = Tk()</p><p># window1 = Window(root)</p><p># # window1.insLi('00')</p><p></p><p>class Window:</p><p></p><p></p><p> def __init__(self,root,queue) -> None:</p><p> self.queue = queue</p><p> self.root = root</p><p> </p><p></p><p></p><p> def main(self):</p><p> # Creating the root window</p><p></p><p> self.root.geometry("609x96+951+216")</p><p> self.root.minsize(120, 1)</p><p> self.root.maxsize(2052, 1133)</p><p> self.root.resizable(1, 1)</p><p> self.root.title("Signal")</p><p> self.root.configure(background="#d9d9d9")</p><p> self.root.configure(highlightbackground="#d9d9d9")</p><p> self.root.configure(highlightcolor="black")</p><p></p><p> # Creating a Listbox and</p><p> # attaching it to root window</p><p> listbox = Listbox(self.root)</p><p> self.lb = listbox</p><p> # Adding Listbox to the left</p><p> # side of root window</p><p> listbox.pack(side=LEFT, fill=BOTH)</p><p></p><p> # Creating a Scrollbar and</p><p> # attaching it to root window</p><p> scrollbar = Scrollbar(self.root)</p><p></p><p> # Adding Scrollbar to the right</p><p> # side of root window</p><p> scrollbar.pack(side=RIGHT, fill=BOTH)</p><p></p><p> # Insert elements into the listbox</p><p> # for values in range(100):</p><p></p><p> listbox.config(yscrollcommand=scrollbar.set)</p><p> listbox.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0)</p><p> listbox.configure(background="#000000")</p><p> listbox.configure(disabledforeground="#6d6d6d")</p><p> listbox.configure(font="-family {Segoe UI Semibold} -size 18 -weight bold")</p><p> listbox.configure(foreground="#04ff24")</p><p> listbox.configure(highlightbackground="#d9d9d9")</p><p> listbox.configure(highlightcolor="black")</p><p> listbox.configure(selectbackground="blue")</p><p> listbox.configure(selectforeground="white")</p><p></p><p></p><p> # listbox.selection_set(END)</p><p> # listbox.see(END)</p><p></p><p> scrollbar.config(command=listbox.yview)</p><p> </p><p> def update_list():</p><p> while True:</p><p> data = self.queue.get()</p><p> self.lb.selection_clear(0,END)</p><p> self.lb.insert(END, data)</p><p> self.lb.selection_set(END)</p><p> self.lb.see(END)</p><p> </p><p> thread = threading.Thread(target=update_list, daemon=True)</p><p> thread.start()</p><p> </p><p> # self.root.after(1000,insLi)</p><p> self.root.mainloop()</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="0x9, post: 27191914, member: 528773"] python ගැන නම් ලොකුවට දන්නේ නෑ, string එකකට වඩා queue එකක් use කරොත් වැඩේ ලේසි වෙයි නේද? [ATTACH type="full"]154350[/ATTACH] modified code එක updater.py [CODE=python] from tkinter import * import threading, queue import GUI as sf c = threading.Condition() def popupmsg(q): root = Tk() window = sf.Window(root,q) window.main() q = queue.Queue() t = threading.Thread(target=popupmsg,args=(q,)) t.start() data = ["apple", "banana", "cherry"] for x in data: q.put(x) [/CODE] GUI.py [CODE=python] from tkinter import * import time import threading # def main(): # root = Tk() # window1 = Window(root) # # window1.insLi('00') class Window: def __init__(self,root,queue) -> None: self.queue = queue self.root = root def main(self): # Creating the root window self.root.geometry("609x96+951+216") self.root.minsize(120, 1) self.root.maxsize(2052, 1133) self.root.resizable(1, 1) self.root.title("Signal") self.root.configure(background="#d9d9d9") self.root.configure(highlightbackground="#d9d9d9") self.root.configure(highlightcolor="black") # Creating a Listbox and # attaching it to root window listbox = Listbox(self.root) self.lb = listbox # Adding Listbox to the left # side of root window listbox.pack(side=LEFT, fill=BOTH) # Creating a Scrollbar and # attaching it to root window scrollbar = Scrollbar(self.root) # Adding Scrollbar to the right # side of root window scrollbar.pack(side=RIGHT, fill=BOTH) # Insert elements into the listbox # for values in range(100): listbox.config(yscrollcommand=scrollbar.set) listbox.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) listbox.configure(background="#000000") listbox.configure(disabledforeground="#6d6d6d") listbox.configure(font="-family {Segoe UI Semibold} -size 18 -weight bold") listbox.configure(foreground="#04ff24") listbox.configure(highlightbackground="#d9d9d9") listbox.configure(highlightcolor="black") listbox.configure(selectbackground="blue") listbox.configure(selectforeground="white") # listbox.selection_set(END) # listbox.see(END) scrollbar.config(command=listbox.yview) def update_list(): while True: data = self.queue.get() self.lb.selection_clear(0,END) self.lb.insert(END, data) self.lb.selection_set(END) self.lb.see(END) thread = threading.Thread(target=update_list, daemon=True) thread.start() # self.root.after(1000,insLi) self.root.mainloop() [/CODE] [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom