Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Checkbox wxPython复选框未设置值_Checkbox_Wxpython - Fatal编程技术网

Checkbox wxPython复选框未设置值

Checkbox wxPython复选框未设置值,checkbox,wxpython,Checkbox,Wxpython,所以我有一个wxPython窗口,我已经做了,它工作得很好,直到我尝试添加一个新的复选框,给用户一个不对称的选项 import poser import random import wx import wx.py import wx.aui scene = poser.Scene() man = poser.WxAuiManager() root = man.GetManagedWindow() fig = scene.CurrentFigure() allowAsymetric = Fa

所以我有一个wxPython窗口,我已经做了,它工作得很好,直到我尝试添加一个新的复选框,给用户一个不对称的选项

import poser
import random
import wx
import wx.py
import wx.aui


scene = poser.Scene()
man = poser.WxAuiManager()
root = man.GetManagedWindow()

fig = scene.CurrentFigure()
allowAsymetric = False
paramList = []

lst = ["Full Body Morphs","All Head/Face", "Face Shape", "Forehead","Eyes", "Ear",  "Nose", "Cheek", "Chin/Jaw", "Lips"]


# Our dialog box
class userInput(wx.Frame):

    def __init__(self, parent) :

        # Call the parent class initialisation method
        wx.Frame.__init__(self, parent = parent, pos=wx.Point(675, 323), size=wx.Size(400, 400), style=wx.DEFAULT_FRAME_STYLE, title = "Random Hive")

        global lst, allowAsymetric


        # Set up the UI
        #self.CenterOnScreen(wx.BOTH)
        self.panel = wx.Panel(self,id=-1,size=(400,350))
        self.panel.SetBackgroundColour("#4B4B4B")


        # Checklist
        self.lb = wx.CheckListBox(self.panel, -1, (20, 20), (350,200), lst)



        #Select All Button
        self.SelectALL = wx.Button(self.panel,id=100,pos=(20,260),size=(-1,- 1),label="Select All")
        self.SelectALL.SetBackgroundColour("#5D5D5D") 
        self.SelectALL.SetForegroundColour("#CBCBCB") 
        self.SelectALL.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseOver) 
        self.SelectALL.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) 
        self.Bind(wx.EVT_BUTTON, self.OnSelectALL, self.SelectALL)

        #Select None Button
        self.SelectNONE = wx.Button(self.panel,id=110,pos=(150,260),size=(-1,- 1),label="Select None")
        self.SelectNONE.SetBackgroundColour("#5D5D5D") 
        self.SelectNONE.SetForegroundColour("#CBCBCB") 
        self.SelectNONE.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseOver) 
        self.SelectNONE.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) 
        self.Bind(wx.EVT_BUTTON, self.OnSelectNONE, self.SelectNONE)

        #Inversion Button
        self.SelectINVERT = wx.Button(self.panel,id=120,pos=(275,260),size=(- 1,-1),label="Invert Selection")
        self.SelectINVERT.SetBackgroundColour("#5D5D5D") 
        self.SelectINVERT.SetForegroundColour("#CBCBCB") 
        self.SelectINVERT.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseOver) 
        self.SelectINVERT.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) 
        self.Bind(wx.EVT_BUTTON, self.OnSelectINVERT, self.SelectINVERT)

        # Cancel button
        self.Cancel = wx.Button(self.panel,id=140,pos=(20,310),size=(-1,-1),label="Close")
        self.Cancel.SetBackgroundColour("#5D5D5D")
        self.Cancel.SetForegroundColour("#CBCBCB")
        self.Cancel.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseOver)
        self.Cancel.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
        self.Cancel.Bind(wx.EVT_BUTTON, self.OnSelectCancel, self.Cancel)

        # Ok button
        self.OK = wx.Button(self.panel,id=150, pos=(275,310),size=(-1,-1),label="Apply")
        self.OK.SetDefault()
        self.OK.SetBackgroundColour("#5D5D5D")
        self.OK.SetForegroundColour("#CBCBCB")
        self.OK.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseOver)
        self.OK.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
        self.Bind(wx.EVT_BUTTON, self.OnSelectOK, self.OK)

        #Undoe Button
        self.Undo = wx.Button(self.panel, id = 130, pos = (150,310), size= (-1,-1), label = "Undo Morphs")
        self.Undo.SetBackgroundColour("#5D5D5D")
        self.Undo.SetForegroundColour("#CBCBCB")
        self.Undo.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseOver) 
        self.Undo.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) 
        self.Bind(wx.EVT_BUTTON, self.OnUndo, self.Undo)

        #static text
        self.infoLable = wx.StaticText(self.panel, pos = (20,230),label = 'Enter Morph Value')
        self.morphNumber = wx.TextCtrl(self.panel, pos = (150,230))

        self.asym = wx.CheckBox(self.panel, label='Asymetric', pos=(275, 230))
        #asym.SetValue(False)

        #asym.Bind(wx.EVT_CHECKBOX, self.AsymetricOn)
        self.Bind(wx.EVT_CHECKBOX, self.AsymetricOn, self.asym)


    def AsymetricOn(self, event):
        sender = event.GetEventObject()
        if sender.GetValue() == True:
            allowAsymetric = True
        else:
            allowAsymetric = False
        print allowAsymetric

    def OnSelectALL(self,event): 
        i=0
        while i < len(lst): 
            self.lb.Check(i,True) 
            i=i+1

    def OnSelectNONE(self,event):
        i=0
        while i < len(lst): 
            self.lb.Check(i,False) 
            i=i+1

    def OnSelectINVERT(self,event): 
        i=0
        while i < len(lst):
            if self.lb.IsChecked(i) == True:
                action = False
                self.lb.Check(i,action)
                i=i +1
                continue
            elif self.lb.IsChecked(i) == False:
                action = True 
                self.lb.Check(i,action) 
                i=i+1
                continue
            i=i+1

    def OnSelectOK(self,event):
        fig.Memorize()
        smn = self.morphNumber.GetString(0,self.morphNumber.GetLineLength(0))       
        try:
            mN = float(smn)
            print "before function choice asymetric is ", allowAsymetric
            functionChoice(self.lb.GetCheckedStrings(), mN) 
            print "after is it ", allowAsymetric
        except:
            print 'Enter a morph value'


    def OnUndo(self,event):
        fig.Reset()
        scene.Draw()

    def OnSelectCancel(self,event):
        #print "Cancel clicked"
        self.Destroy()

    def OnMouseOver(self,event):
        element = event.GetEventObject()
        element.SetBackgroundColour("#737373")
        event.Skip()

    def OnMouseLeave(self,event):
        element = event.GetEventObject()
        element.SetBackgroundColour("#5D5D5D")
        event.Skip()
导入poser
随机输入
导入wx
导入wx.py
导入wx.aui
scene=poser.scene()
man=poser.WxAuiManager()
root=man.GetManagedWindow()
图=场景。当前图()
allowAsymetric=False
参数列表=[]
lst=[“全身变形”,“全部头部/面部”,“面部形状”,“前额”,“眼睛”,“耳朵”,“鼻子”,“脸颊”,“下巴/下巴”,“嘴唇”]
#我们的对话框
类userInput(wx.Frame):
定义初始化(自身,父级):
#调用父类初始化方法
wx.Frame.\uuuuu init\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
全球地表温度
#设置用户界面
#屏幕上的self.center(wx.BOTH)
self.panel=wx.panel(self,id=-1,size=(400350))
自拼板立根底色(“4B4B”)
#检查表
self.lb=wx.复选框(self.panel,-1,(20,20),(350200),lst)
#全选按钮
self.SelectALL=wx.按钮(self.panel,id=100,pos=(20260),size=(-1,-1),label=“全选”)
self.SelectALL.setbackgroundColor(“5D5D”)
self.SelectALL.setForeGroundColor(“CBCB”)
self.SelectALL.Bind(wx.EVT\u进入\u窗口,self.OnMouseOver)
self.SelectALL.Bind(wx.EVT\u LEAVE\u窗口,self.OnMouseLeave)
self.Bind(wx.EVT_按钮、self.OnSelectALL、self.SelectALL)
#选择无按钮
self.SelectNONE=wx.按钮(self.panel,id=110,pos=(150260),size=(-1,-1),label=“Select None”)
self.SelectNONE.setbackgroundcolor(“#5d5d”)
self.SelectNONE.setForeGroundColor(“CBCB”)
self.SelectNONE.Bind(wx.EVT\u进入\u窗口,self.OnMouseOver)
self.SelectNONE.Bind(wx.EVT\u LEAVE\u窗口,self.OnMouseLeave)
self.Bind(wx.EVT_按钮、self.OnSelectNONE、self.SelectNONE)
#反转按钮
self.SelectINVERT=wx.按钮(self.panel,id=120,pos=(275260),size=(-1,-1),label=“Invert Selection”)
self.SelectINVERT.SetbackgroundColor(“5D5D”)
self.SelectINVERT.SetForeGroundColor(“CBCB”)
self.SelectINVERT.Bind(wx.EVT\u进入窗口,self.OnMouseOver)
self.SelectINVERT.Bind(wx.EVT_LEAVE_窗口,self.OnMouseLeave)
self.Bind(wx.EVT_按钮、self.OnSelectINVERT、self.SelectINVERT)
#取消按钮
self.Cancel=wx.Button(self.panel,id=140,pos=(20310),size=(-1,-1),label=“Close”)
self.Cancel.setbackgroundColor(“5D5D”)
self.Cancel.setForeGroundColor(“CBCB”)
self.Cancel.Bind(wx.EVT_进入_窗口,self.OnMouseOver)
self.Cancel.Bind(wx.EVT_LEAVE_窗口,self.OnMouseLeave)
self.Cancel.Bind(wx.EVT_按钮、self.OnSelectCancel、self.Cancel)
#Ok按钮
self.OK=wx.按钮(self.panel,id=150,pos=(275310),size=(-1,-1),label=“Apply”)
self.OK.SetDefault()
self.OK.setbackgroundColor(“5D5D”)
self.OK.setForeGroundColor(“CBCB”)
self.OK.Bind(wx.EVT_进入_窗口,self.OnMouseOver)
self.OK.Bind(wx.EVT_LEAVE_窗口,self.OnMouseLeave)
self.Bind(wx.EVT_按钮、self.OnSelectOK、self.OK)
#撤消按钮
self.Undo=wx.Button(self.panel,id=130,pos=(150310),size=(-1,-1),label=“Undo Morphs”)
self.Undo.setbackgroundColor(“5D5D”)
self.Undo.setForeGroundColor(“CBCB”)
self.Undo.Bind(wx.EVT_进入_窗口,self.OnMouseOver)
self.Undo.Bind(wx.EVT_LEAVE_窗口,self.OnMouseLeave)
self.Bind(wx.EVT_按钮、self.OnUndo、self.Undo)
#静态文本
self.infoLable=wx.StaticText(self.panel,pos=(20230),label=‘输入变形值’)
self.morphNumber=wx.TextCtrl(self.panel,pos=(150230))
self.asym=wx.CheckBox(self.panel,label='Asymetric',pos=(275230))
#自动设定值(假)
#asym.Bind(wx.EVT_复选框,self.AsymetricOn)
self.Bind(wx.EVT_复选框、self.AsymetricOn、self.asym)
def AsymetricOn(自身、事件):
sender=event.GetEventObject()
如果sender.GetValue()==True:
allowAsymetric=True
其他:
allowAsymetric=False
打印等速
def OnSelectALL(自身、事件):
i=0
而i
当窗口弹出时,我可以很好地勾选和取消勾选复选框,然后打印出正确的va