943,971 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 5794
  • Python RSS
Feb 22nd, 2007
0

Wx Plot

Expand Post »
i have problem with this code:
Python Syntax (Toggle Plain Text)
  1. def __init__(self,parent):
  2. data = [(1,2), (2,3), (3,5), (4,6), (5,8), (6,8), (10,10)]
  3. self.okno=wx.Frame(None,title="Graf",id=-1)
  4.  
  5. sizer=wx.BoxSizer(wx.HORIZONTAL)
  6. ram=wx.Panel(self.okno)
  7. client = plot.PlotCanvas(ram)
  8. line = plot.PolyLine(data, legend='', colour='pink', width=1)
  9. gc = plot.PlotGraphics([line], 'Line Graph', 'X Axis', 'Y Axis')
  10. client.Draw(gc, xAxis= (0,15), yAxis= (0,15))
  11. sizer.Add(ram,1,0,wx.ALL)
  12. self.okno.SetSizer(sizer)
  13. self.okno.Layout()
  14. self.okno.Show(True)
why plot is so small? i am new in Wx...


thanks
Similar Threads
Reputation Points: 17
Solved Threads: 1
Junior Poster in Training
Blujacker is offline Offline
56 posts
since Mar 2006
Feb 22nd, 2007
0

Re: Wx Plot

You need to give us the full code, or we won't know where 'plot' is coming from.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Feb 23rd, 2007
0

Re: Wx Plot

Python Syntax (Toggle Plain Text)
  1. import wx
  2. import wx.lib.plot as plot
  3. class Example:
  4. def __init__(self):
  5. data = [(1,2), (2,3), (3,5), (4,6), (5,8), (6,8), (10,10)]
  6. self.okno=wx.Frame(None,title="Graf",id=-1)
  7.  
  8. sizer=wx.BoxSizer(wx.VERTICAL)
  9. ram=wx.Panel(self.okno)
  10. client = plot.PlotCanvas(ram)
  11. line = plot.PolyLine(data, legend='', colour='pink', width=1)
  12. gc = plot.PlotGraphics([line], 'Line Graph', 'X Axis', 'Y Axis')
  13. client.Draw(gc, xAxis= (0,15), yAxis= (0,15))
  14. sizer.Add(ram,1,0,wx.ALL)
  15. sizer.Add(wx.Button(self.okno,label="Button"))
  16. self.okno.SetSizer(sizer)
  17. self.okno.Layout()
  18. self.okno.Show(True)
  19. okno = wx.App(0)
  20. Example()
  21. okno.MainLoop()
this is a little example.. In the window must be graph and several buttons, but graph is too small
Thanks for all post
Reputation Points: 17
Solved Threads: 1
Junior Poster in Training
Blujacker is offline Offline
56 posts
since Mar 2006
Feb 23rd, 2007
0

Re: Wx Plot

You need to give the canvas a size, like this ...

client = plot.PlotCanvas(ram, size = (300, 350))
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Feb 23rd, 2007
0

Re: Wx Plot

it doesnt work.
code:
Python Syntax (Toggle Plain Text)
  1. import wx,os
  2. import wx.lib.plot as plot
  3. class Example:
  4. def __init__(self):
  5. data = [(1,2), (2,3), (3,5), (4,6), (5,8), (6,8), (10,10)]
  6. self.okno=wx.Frame(None,title="Graf",id=-1)
  7.  
  8. sizer=wx.BoxSizer(wx.VERTICAL)
  9. ram=wx.Panel(self.okno)
  10. client = plot.PlotCanvas(ram, size = (300, 350))
  11. line = plot.PolyLine(data, legend='', colour='pink', width=1)
  12. gc = plot.PlotGraphics([line], 'Line Graph', 'X Axis', 'Y Axis')
  13. client.Draw(gc, xAxis= (0,15), yAxis= (0,15))
  14. sizer.Add(ram,1,0,wx.ALL)
  15. sizer.Add(wx.Button(self.okno,label="Button"))
  16. self.okno.SetSizer(sizer)
  17. if os.path.exists("tips.txt"):
  18. wx.CallAfter(self.okno.ShowTip, wx.GetApp().GetTopWindow(), wx.CreateFileTipProvider("tips.txt", 0))
  19. self.okno.Layout()
  20. self.okno.Show(True)
  21. okno = wx.App(0)
  22. Example()
  23. okno.MainLoop()
and i get error:
Python Syntax (Toggle Plain Text)
  1. Traceback (most recent call last):
  2. File "C:\Documents and Settings\Blu\Plocha\aa.py", line 25, in -toplevel-
  3. Example()
  4. File "C:\Documents and Settings\Blu\Plocha\aa.py", line 12, in __init__
  5. client = plot.PlotCanvas(ram, size = wx.Size(300, 350))
  6. TypeError: __init__() got an unexpected keyword argument 'size'
Reputation Points: 17
Solved Threads: 1
Junior Poster in Training
Blujacker is offline Offline
56 posts
since Mar 2006
Feb 24th, 2007
0

Re: Wx Plot

Solved, i rewrite class plot.PlotCanvas and now it works fine...
Reputation Points: 17
Solved Threads: 1
Junior Poster in Training
Blujacker is offline Offline
56 posts
since Mar 2006
Feb 24th, 2007
0

Re: Wx Plot

Glad you could solve it. Worked on my machine here XP, Python24, wx26 just fine.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Wx Unicode
Next Thread in Python Forum Timeline: dumb question about lists





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC