Wx Plot

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2006
Posts: 56
Reputation: Blujacker is an unknown quantity at this point 
Solved Threads: 1
Blujacker Blujacker is offline Offline
Junior Poster in Training

Wx Plot

 
0
  #1
Feb 22nd, 2007
i have problem with this code:
  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,109
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 943
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Wx Plot

 
0
  #2
Feb 22nd, 2007
You need to give us the full code, or we won't know where 'plot' is coming from.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 56
Reputation: Blujacker is an unknown quantity at this point 
Solved Threads: 1
Blujacker Blujacker is offline Offline
Junior Poster in Training

Re: Wx Plot

 
0
  #3
Feb 23rd, 2007
  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,109
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 943
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Wx Plot

 
0
  #4
Feb 23rd, 2007
You need to give the canvas a size, like this ...

client = plot.PlotCanvas(ram, size = (300, 350))
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 56
Reputation: Blujacker is an unknown quantity at this point 
Solved Threads: 1
Blujacker Blujacker is offline Offline
Junior Poster in Training

Re: Wx Plot

 
0
  #5
Feb 23rd, 2007
it doesnt work.
code:
  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:
  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'
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 56
Reputation: Blujacker is an unknown quantity at this point 
Solved Threads: 1
Blujacker Blujacker is offline Offline
Junior Poster in Training

Re: Wx Plot

 
0
  #6
Feb 24th, 2007
Solved, i rewrite class plot.PlotCanvas and now it works fine...
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,109
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 943
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Wx Plot

 
0
  #7
Feb 24th, 2007
Glad you could solve it. Worked on my machine here XP, Python24, wx26 just fine.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC