Jump to content

First wxPython Tool


few_a_fx

Recommended Posts

Hey guys, It's been a while since my last post on here. Anyways trying to create my first fx tool for houdini. I'm using wxPython and python to create it. Right now I'm a little stuck on creating the GUI for the tool. Need to create 3 text boxes (one for each axis XYZ). Also need to create a text boxe for my sliders, that will display the number the slide is on, plus allow me to enter in an expression. If anyone can help me out that would awesome. here is the code. the main line I need help with is line 27.

import wx

# Creates the Window for the App.
class MyFxTool(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size (450, 320),
                          style = wx.CAPTION | wx.SYSTEM_MENU | wx.CLOSE_BOX)

        # Creates Titles
        title1 = ''' Rain System '''
        title2 = ''' Amount of Rain '''
        title3 = ''' Rain Speed '''
        title4 = ''' Wind Direction '''
        title5 = ''' Wind Speed '''
        title6 = ''' Life '''
        title7 = ''' Collisions '''
        title8 = ''' Bounce '''

        # Creates Options for collideOp.
        options = ['Die', 'Bounce', 'Stop', 'Slide', 'Stick']

        # Create GUI elements.
        panel = wx.Panel(self, -1)
        startButton = wx.Button(panel, 2, 'Make It Rain', (175, 25))
        amountSlider = wx.Slider(panel, 3, 10, 1, 200, pos = (175, 55))
        rSpeedSlider = wx.Slider(panel, 4, 10, 1, 200, pos = (175, 85))
        wDirection = wx.TextEntryDialog(panel, '', 'X','', pos = (175,115))
        wSpeedSlider = wx.Slider(panel, 6, 10, 1, 200, pos = (175, 145))
        lifeSlider = wx.Slider(panel, 7, 10, 1, 200, pos = (175, 175))
        collideOn = wx.CheckBox(panel, 8, 'On/Off', (175, 205))
        collideButton = wx.Button(panel, 8, 'Collide With', (240, 205))
        collideOp = wx.ComboBox(panel, 8, '', (325, 205), choices = options)
        bounceSlider = wx.Slider(panel, 9, 10, 1, 200, pos = (175, 235))


        # Creates the layout for the titles.
        wx.StaticText(panel, -1, title1, (20, 25), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title2, (20, 55), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title3, (20, 85), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title4, (20, 115), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title5, (20, 145), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title6, (20, 175), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title7, (20, 205), style = wx.ALIGN_LEFT)
        wx.StaticText(panel, -1, title8, (20, 235), style = wx.ALIGN_LEFT)
        self.Centre()



class MyApp(wx.App):
    def OnInit(self):
        frame = MyFxTool(None, -1, 'Rain System Tool')
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()

Thanks

---Jason

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...