Buttons are not added in the string

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 (7.23 KB)

ELEMENT.py (7.61 KB)

Himanshu Pareek wrote:

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.

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, timr@probo.com
Providenza & Boekelheide, Inc.

I have used boxsizer and getlabeltext to print the name of button

See my code https://github.com/svnitHIMANSHU/Raman-spectroscopy-database

···

On 13 June 2017 at 22:11, Tim Roberts timr@probo.com wrote:

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.

Himanshu Pareek wrote:

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.

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, timr@probo.com

Providenza & Boekelheide, Inc.

Himanshu pareek

Applied physics Department

Sardar Vallabhbhai National Institute of Technology, Surat.

Contact No.- 8437385593

Himanshu Pareek wrote:

I have used boxsizer and getlabeltext to print the name of button
See my code GitHub - svnitHIMANSHU/Raman-spectroscopy-database: This is to make a database of raman spectra of molecules.

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():
        # ...

···

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