self.SetCellBackgroundColour(0, 16, "#ffffff")
AttributeError: 'TestFrame' object has no attribute 'SetCellBackgroundColour'
import wx
import wx.grid as gridlib
class SimpleGrid(gridlib.Grid): ##, mixins.GridAutoEditMixin):
def __init__(self, parent, log):
gridlib.Grid.__init__(self, parent, -1)
[... Some Code to Create the grid]
class TestFrame(wx.Frame):
def __init__(self, parent, log):
wx.Frame.__init__(self, parent, 0, "Native Ads Reports V1.0", size=(1400,800))
self.grid = SimpleGrid(self, log)
# Create a status-Bar
status = self.CreateStatusBar()
# Create menu & Items
menubar = wx.MenuBar()
first = wx.Menu()
applyItem = first.Append(wx.ID_ANY, "Apply Changes", "This apply all changes to the campaigns" )
resetItem = first.Append(wx.ID_ANY, "Reset Changes", "This Reset all changes to the campaigns" )
menubar.Append(first, "Action")
self.SetMenuBar(menubar)
# Associate a handler function with the EVT_MENU
self.Bind(wx.EVT_MENU, self.OnApply, applyItem)
self.Bind(wx.EVT_MENU, self.OnReset, resetItem)
def OnApply(self, event):
"""Apply all changes"""
dlg = wx.MessageDialog(None, "Do you want to apply changes?",'Updater',wx.YES_NO | wx.ICON_QUESTION)
result = dlg.ShowModal()
if result == wx.ID_YES:
self.count()
from changeBid import changeBid
changeBidTbBulk()
#My problem is situated here. If the user clicks "Yes" in the dialog box the table should reset and all modifications should be deleted
def OnReset(self, event):
"""Apply all changes"""
dlg = wx.MessageDialog(None, "Do you want to reset all changes?",'Updater',wx.YES_NO | wx.ICON_QUESTION)
result = dlg.ShowModal()
if result == wx.ID_YES:
db_conn.execute("DELETE FROM SandboxTB")
db_conn.execute("DELETE FROM SandboxOB")
db_conn.commit()
# Here I tried to change background
self.SetCellBackgroundColour(0, 16, "#ffffff")
#and here the refresh
self.ForceRefresh()--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/70d0993a-d6b2-4e75-bc69-4dcfeb7b234f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Try self.grid.SetCellBackgroundColour
To unsubscribe from this group and stop receiving emails from it, send an email to wxpytho...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/f397dca1-8657-4b74-a29c-3a5a841881b2%40googlegroups.com.
inside the TestFrame object self refers to the TestFrame instance. You were trying to call a method that belongs to self.grid on your frame, which does not have a method called SetCellBackgroundColour.Take no offense, but if you don't know the reason why it is working with self.grid, you should probably catch up with the basics of python.