wxchoice appenitems not working

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
dolamitejenkins
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Feb 27, 2015 8:33 pm

wxchoice appenitems not working

Post by dolamitejenkins »

When I try to "append" the rows returned to the widget only one row is shown and when i try to "append items" to the widget only one row is shown and it is shown as a column ... what am I doing wrong ???

Code: Select all

self.weather2 = wx.Choice(self.panel, wx.ID_ANY, choices = self.nameofevet1, name='ShowList')
	self.populateVenue(self)

def populateVenue(self,event):
	conn = lite.connect("PermPatRecord.sqlite")
        c = conn.cursor()
        c.execute('select * from showlist')
	rows=c.fetchall()
            
	rRows=[]
	for row in rows:
                s={}
                s['Venue_name']  =row[1] 
		
		self.nameofevet1 = s['Venue_name']
		print self.nameofevet1
		
	self.weather2.Clear()
	self.weather2.AppendItems(self.nameofevet1)
	
    
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxchoice appenitems not working

Post by doublemax »

I don't know Python too well, but this line seems wrong:

Code: Select all

self.nameofevet1 = s['Venue_name']
I don't know what type nameofevet1 is, but if it's some kind of list, you have to append the current item instead of just assigning it.
Use the source, Luke!
dolamitejenkins
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Feb 27, 2015 8:33 pm

Re: wxchoice appenitems not working

Post by dolamitejenkins »

reworked the querry to make sure I get a list and still not working correctly it only appends the last item in the list

Code: Select all

conn = lite.connect("C:\Python26\sign1\VenueShow\PermPatRecord.sqlite")
	with conn:
	    conn.row_factory = lite.Row
	    c = conn.cursor()
	    c.execute('select * from showlist')
	    rows=c.fetchall()
	    for row in rows:
		self.nameofevet1= row[1]
		self.weather2.Clear()
		self.weather2.Append(self.nameofevet1)
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxchoice appenitems not working

Post by doublemax »

Remove this line:

Code: Select all

self.weather2.Clear()
Use the source, Luke!
Post Reply