Buttons are not added in the string

27 views
Skip to first unread message

Himanshu Pareek

unread,
Jun 13, 2017, 4:11:26 AM6/13/17
to wxPython-users
I am trying to link my sqlite database with wxpython GUI.i use for loop to add buttons in the grid , and i want to label the buttons also. So  when i do that it is printing all the button labels in the terminal and not making grid at all.
gui.py
ELEMENT.py

Tim Roberts

unread,
Jun 13, 2017, 12:41:16 PM6/13/17
to wxpytho...@googlegroups.com
I'm confused about what you're trying to accomplish here. You haven't
actually added a button into the grid. You have simply added a custom
renderer that draws the same stuff that a button would draw.
wx.RendererNative.Get().DrawPushButton does the drawing that a button
would do, but it doesn't actually create a button. If you want a label
drawn, you have to pass the label into DrawPushButton. You aren't doing
that right now.

I see "clicked" in the log when I run your example. I don't know what
you mean by "not making grid at all".

You haven't explained your app, but you might think about whether a
GridBadSizer would be better suited to your task than a grid with a lot
of customization.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Himanshu Pareek

unread,
Jun 14, 2017, 3:10:11 AM6/14/17
to wxpytho...@googlegroups.com
I have used boxsizer and getlabeltext to print the name of button
See my code https://github.com/svnitHIMANSHU/Raman-spectroscopy-database

Himanshu pareek
Applied physics Department
Sardar Vallabhbhai National Institute of Technology, Surat.
Contact No.- 8437385593




--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/ztHYl2jIe04/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim Roberts

unread,
Jun 14, 2017, 2:02:45 PM6/14/17
to wxpytho...@googlegroups.com
Himanshu Pareek wrote:
> I have used boxsizer and getlabeltext to print the name of button
> See my code https://github.com/svnitHIMANSHU/Raman-spectroscopy-database

That code contains no grids and no buttons.

You are making more than 200 separate queries to your database. It
would be much smarter to make one query and process the rows and columns
as you receive them:
cursor = self.conn.execute( "SELECT * FROM element ORDER BY row_no,
col_no;" )
for element in cursor.fetchall():
# ...
Reply all
Reply to author
Forward
0 new messages