Discussion: créer un graphique
Afficher un message
Vieux 30/08/2007, 12h23   #7
jean-michel bain-cornu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: créer un graphique

Bonjour,
> Vous pensez bien que ce n'est pas terminé, j'aimerais créer la
> sinusoide.
>
> Pourriez vous m'expliquer la demarche SVP.

Tu peux le faire avec wx, même si les modules déjà cités sont
probablement beaucoup plus adaptés.

Exemple :

import math,wx
#----------------------------------------------------------------------
class DrawPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.SetBackgroundColour(wx.WHITE)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.points = []
x= float(0)
for n in range(10000):
x+= 0.25
k= float(n)/100
self.points.append((int(x),int(math.sin(k)*100)+10 0))
def OnPaint(self, evt):
dc = wx.PaintDC(self)
dc.BeginDrawing()
dc.Clear()
dc.SetPen(wx.Pen("BLACK", 4))
dc.DrawPointList(self.points)
dc.EndDrawing()
#----------------------------------------------------------------------
app= wx.PySimpleApp()
frame=wx.Frame(None,wx.ID_ANY,'Test')
panel= DrawPanel(frame)
frame.Show()
app.MainLoop()
#----------------------------------------------------------------------
  Réponse avec citation
 
Page generated in 0,04726 seconds with 9 queries