Search Results

Search found 2 results on 1 pages for 'somefreakingguy'.

Page 1/1 | 1 

  • Why can't I pass an argument to create this window using wxpython?

    - by somefreakingguy
    I am trying to learn how to make a GUI in python! Following an online tutorial, I found that the following code 'works' in creating an empty window: import wx from sys import argv class bucky(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Frame aka window', size=(300, 200)) if __name__=='__main__': app=wx.PySimpleApp() frame=bucky(parent=None,id=-1) frame.Show() app.MainLoop() That gives me a window, which is great. However, what if I want to get an argument passed onto the program to determine the window size? I thought something like this ought to do the trick: import wx from sys import argv script, x, y = argv class mywindow(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Frame aka window', size=(x, y)) if __name__=='__main__': app=wx.PySimpleApp() frame=mywindow(parent=None,id=-1) frame.Show() app.MainLoop() But, alas, that does not work! Nor does the raw_input() function pass on the value. I keep getting the following error: C:/Python26/pythonw.exe -u "C:/Documents and Settings/Owner/Desktop/wz.py" File "C:/Documents and Settings/Owner/Desktop/wz.py", line 8 wx.Frame.__init__(self, parent, id, 'Frame aka window', size=(x y)) ^ SyntaxError: invalid syntax Thanks for the help!

    Read the article

  • How do I get user input to refer to a variable in Python?

    - by somefreakingguy
    I would like to get user input to refer to some list in my code. I think it's called namespace? So, what would I have to do to this code for me to print whatever the user inputs, supposing they input 'list1' or 'list2'? list1 = ['cat', 'dog', 'juice'] list2 = ['skunk', 'bats', 'pogo stick'] x = raw_input('which list would you like me to print?') I plan to have many such lists, so a series of if...then statements seems unruly.

    Read the article

1