Advertisement
Guest User

Diccionario WXpython

a guest
Apr 18th, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. # Creado Por LED
  2. # -*- coding: utf-8 -*-
  3. import wx
  4. import wx.xrc
  5. import sys
  6. ###########################################################################
  7. ## Class MyFrame1
  8. ###########################################################################
  9. class MyFrame2 ( wx.Frame ):
  10.  
  11. def __init__( self, parent ):
  12. wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Diccionario de objetos wx", pos = wx.DefaultPosition, size = wx.Size( 500,454 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
  13.  
  14. self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
  15.  
  16. bSizer1 = wx.BoxSizer( wx.VERTICAL )
  17.  
  18. self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
  19. bSizer2 = wx.BoxSizer( wx.VERTICAL )
  20.  
  21. bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
  22.  
  23. bSizer5 = wx.BoxSizer( wx.VERTICAL )
  24.  
  25. self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Objetos", wx.DefaultPosition, wx.DefaultSize, 0 )
  26. self.m_staticText2.Wrap( -1 )
  27. bSizer5.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
  28.  
  29. m_listBox2Choices = [ u"wx.Frame", u"wx.Button", u"wx.StaticText",u'wx.ListBox',u'wx.BitmapButton',u'wx.TextCtrl',u'wx.BoxSizer',u'wx.ComboBox',u'wx.lib.calendar',u'wx.ComboBox',u'wx.CheckBox',u'wx.StaticBoxSizer']
  30. self.m_listBox2 = wx.ListBox( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox2Choices, 0 )
  31. bSizer5.Add( self.m_listBox2, 1, wx.ALL|wx.EXPAND, 5 )
  32.  
  33. bSizer7.Add( bSizer5, 3, wx.EXPAND, 5 )
  34.  
  35. bSizer3 = wx.BoxSizer( wx.VERTICAL )
  36.  
  37. self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Funciones y Propiedades", wx.DefaultPosition, wx.DefaultSize, 0 )
  38. self.m_staticText1.Wrap( -1 )
  39. bSizer3.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
  40.  
  41. m_listBox1Choices = []
  42. self.m_listBox1 = wx.ListBox( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, 0 )
  43. bSizer3.Add( self.m_listBox1, 1, wx.ALL|wx.EXPAND, 5 )
  44.  
  45. bSizer7.Add( bSizer3, 3, wx.EXPAND, 5 )
  46.  
  47. bSizer2.Add( bSizer7, 3, wx.EXPAND, 5 )
  48.  
  49. bSizer8 = wx.BoxSizer( wx.VERTICAL )
  50.  
  51. self.m_textCtrl1 = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH )
  52. bSizer8.Add( self.m_textCtrl1, 1, wx.ALL|wx.EXPAND, 5 )
  53.  
  54. bSizer2.Add( bSizer8, 1, wx.EXPAND, 5 )
  55.  
  56. self.m_panel1.SetSizer( bSizer2 )
  57. self.m_panel1.Layout()
  58. bSizer2.Fit( self.m_panel1 )
  59. bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 0 )
  60.  
  61. self.SetSizer( bSizer1 )
  62. self.Layout()
  63.  
  64. self.Centre( wx.BOTH )
  65. self.Bind(wx.EVT_LISTBOX,self.este, self.m_listBox2)
  66. self.Bind(wx.EVT_LISTBOX,self.este2, self.m_listBox1)
  67.  
  68. def este(self, event): # wxGlade: Principal.<event_handler>
  69. self.m_listBox1.Set(dir(eval(self.m_listBox2.GetStringSelection())))
  70. def este2(self, event): # wxGlade: Principal.<event_handler>
  71. try:
  72. self.m_textCtrl1.SetValue(eval(self.m_listBox2.GetStringSelection()+"."+self.m_listBox1.GetStringSelection()+".im_func.func_doc"))
  73. except:
  74. self.m_textCtrl1.SetValue("No funca")
  75. def __del__( self ):
  76. pass
  77.  
  78. class Inicio(wx.App):
  79. def OnInit(self):
  80. frame = MyFrame2(None)
  81. self.SetTopWindow(frame)
  82. frame.Show(True)
  83. return True
  84.  
  85. if __name__ == '__main__':
  86. app = Inicio()
  87. app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement