• 2021-04-14
    试试理解这个小程序。请选择合适的代码使得如下的程序能够实现在程序Frame中按下鼠标左键时,在鼠标按下的位置出现一个Button,如下图所示。http://edu-image.nosdn.127.net/6F9E2960D773BA3D7598270EA2E5C44B.jpg?imageView&thumbnail=890x0&quality=100import wxclass MyFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, ____, title = title) self.panel = wx.Panel(self) self.____(wx.EVT_LEFT_UP, self.OnClick) self.Show(True) def OnClick(self, event): posm = event.GetPosition() wx._____(_____, label = Hi~~~, pos = (posm.x, posm.y))if __name__ == __main__: app = wx.App() frame = MyFrame(None, Hello Python) app.MainLoop()
  • parent, panel.Bind, Button, self.panel

    内容

    • 0

      以下有关类的声明,正确的是 A: class Student(object) def __init__(self, name, score): self.name = name self.score = score B: class Student(object) def __init__(self, name, score) self.name = name self.score = score C: class Student(object): def __init__(self, name, score): self.name = name self.score = score D: class Student(object): def __int__(self, name, score): self.name = name self.score = score

    • 1

      下面程序运行的结果是( )。class Person:def __init__(self,n="张三"): self.name=nclass Student(Person):def __init__(self,s="male"):self.sex=sdef show(self):print(self.name,self.sex)s=Student("female")s.show() A: 张三 male B: 张三 female C: 出错 D: 张三

    • 2

      定义类如下:class Hello(): def __init__(self,name): self.name=name def showInfo(self): print(self.name)下面代码能正常执行的 ( )。 A: h = Helloh.showInfo() B: h = Hello()h.showInfo('张三') C: h = Hello('张三')h.showInfo() D: h = Hello('admin')h.showInfo

    • 3

      ‎下列程序的输出结果是( )。​‎class Fruit():​‎ def __init__(self):​‎ print('Fruit')​‎ def grow(self):​‎ print('Fruit grow')​‎​‎class Vegetable():​‎ def __init__(self):​‎ print('Vegetable')​‎ def grow(self):​‎ print('Vegetable grow')​‎ ​‎class Tomato(Fruit,Vegetable):​‎ pass​‎​‎t = Tomato()​‎t.grow()​‎​‎知识点:多继承​ A: FruitFruit grow B: FruitVegetable grow C: VegetableFruit grow D: VegetableVegetable grow

    • 4

      class Student: def __init__(self,n="xxx"): self.name=n def show(self): print(self.name)s=Student("yyy")s.show()结果 A: yyy B: xxx C: None D: 错误