خرید بک لینک

Vote count: 0

I am new to python . I am currently creating a GUI which is having 4 options. It means one question and respective 4 choices. User will select 1 choice and when click on OK, it will show a custom Dialog and tell you whether answer is correct or not

import wx

class MyFrame(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, -1, "My Frame", size=(3000, 3000))
        panel = wx.Panel(self,-1)
        #panel.Bind(wx.EVT_MOTION,  self.OnMove)
        wx.StaticText(panel, -1, "What are the values of X", pos=(10, 12))
        #self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(100, 10))
        self.option1 = wx.CheckBox(panel, -1, "Apples", (20,100), (160,-1))
        wx.CheckBox(panel, -1, "Mango", (20,150), (160,-1))
        wx.CheckBox(panel, -1, "Banana", (20,200), (160,-1))
        wx.CheckBox(panel, -1, "Orange", (20,250), (160,-1))
        button=wx.Button(panel,label="OK",pos=(800, 400), size = (50,50))
        self.Bind(wx.EVT_BUTTON, self.newwindow, button)


    # def OnMove(self, event):
        # pos = event.GetPosition()
        # self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))


    def newwindow(self, event):
        dia = MyDialog(None, -1, 'buttons')
        dia.ShowModal()
        dia.Destroy()



class MyDialog(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title, size=(350,300)
        value = MyFrame.self.option1.GetValue()
        print ("***** Value is" , value)
app = wx.App(False)
frame = MyFrame()
frame.Show(True)
app.MainLoop()

I am getting the error. How to get the value of checkBox which is selected by user and pass the same retued value to Dialog class

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 11 فروردين 1395 ساعت: 13:21

صفحه بندی