[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Combobox wx vs gtk
From: |
John Proios |
Subject: |
Combobox wx vs gtk |
Date: |
Sun, 20 Nov 2011 11:07:22 +0200 |
User-agent: |
Gnus/5.0 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hello,
About the delay of the combo box(bringing the data) at ui wx, I did 2
test scripts on the combo box(one for GDK and one for WX) with 10000
entries(data).
The conclusion was chocking(PowerMac G5 2000 Dual)! 2sec in GDK
and 179sec in WX !!!
I was thinking that GDK library is more practical and I was wondering
why you removed it?
Should I search for another library that will have the great interface
of WX and the speed of curses?
What do you think?
import wx
from random import sample
import datetime
a = datetime.datetime.now()
class ComboBoxFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'Combo Box Example', size=(350, 300))
panel = wx.Panel(self, -1)
sampleList = map(str,(sample(xrange(10000),9000)))
wx.StaticText(panel, -1, "Select one:", (15, 15))
wx.ComboBox(panel, -1, "default value", (15, 30),
wx.DefaultSize,sampleList, wx.CB_DROPDOWN)
wx.ComboBox(panel, -1, "default value", (150, 30),
wx.DefaultSize,sampleList, wx.CB_SIMPLE)
app = wx.PySimpleApp()
ComboBoxFrame().Show()
b = datetime.datetime.now()
c = b - a
print c.seconds
app.MainLoop()
#$Id: combobox.py,v 1.2 2004/04/12 01:40:00 mandava Exp $
# This is an example illustrating the combo box.
# Importing pygtk module and initializing the gtk+ environment
import gtk
from random import sample
import datetime
class combobox:
# This is a callback functionthe quits the program.
def delete_event(self,widget,event,data = None):
gtk.main_quit()
return gtk.FALSE
def __init__(self):
# Create a new window.
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
# Set the title of the window to "Combo Box".
self.window.set_title("combo box")
# Set a handler for delete_event that immediately exits GTK.
self.window.connect("delete_event", self.delete_event)
# Set the border width of the window.
self.window.set_border_width(10)
# Create a combo box.
combo = gtk.Combo()
# Add the combo box to the window.
self.window.add(combo)
# Show the newly created combo box.
combo.show()
# Set the string in the entry section of the combo box to
"India"
#combo.entry.set_text("India")
a = datetime.datetime.now()
# Assembling the list of strings we want in the popdown list
slist = map(str,(sample(xrange(10000),9000)))
# Set the values in the popdown list.
combo.set_popdown_strings(slist)
b = datetime.datetime.now()
# Show the window.
self.window.show()
c = b - a
print c.seconds
def main(self):
# All pyGTK applications must have a gtk.main(). Control ends
here
# and waits for an event to occur.
gtk.main()
# If the program is run directly or passed as an argument to the python
# interpreter then create a combobox instance and show it
if __name__ == "__main__" :
widget = combobox()
widget.main()
Sincerely yours
--
.-.
=------------------------ /v\ ------------------------=
// \\
John Proios /( )\
Linux User ^^-^^
- Combobox wx vs gtk,
John Proios <=