wxwidget

Mattepuffo's logo
Usare wxWidgets con Netbeans

Usare wxWidgets con Netbeans

Reputo Netbeans un ottimo IDE, anche per linguaggi come il C++.

Però ho avuto parecchie difficoltà a testare wxWidgets, fino a che ho scoperto due modi per usarlo senza incappare errori.

Do per scontato che abbia installato Netbeans e attivato il plugin C++.

Un primo modo, che a me non ha funzionato ma che vi posto lo stesso, è di creare un link simbolico:

# ln -s /usr/include/wx-3.0 /usr/include/wx

Ad alcuni è bastato, ad altri (me compreso) no.

Mattepuffo's logo
wxPython Grid JSON

wxPython Grid JSON

Negli articoli precedenti abbiamo visto come ottenere dati in formato JSON da un web service, e come creare una wxPython Grid.

Partendo da quegli articoli vediamo come riempire una Grid perndendo in dati in formato JSON.

Partiamo dalla classe che interroga il web service:

import httplib
import json

class Service(object):

    conn = None

    def __init__(self):
        self.conn = httplib.HTTPConnection("www.miosito.it")
        
    def listLogFile(self):
        self.conn.request(method = "GET", url = "/service/log.php", headers = { "Content-Type": "application/json" })
        res = self.conn.getresponse()
        data = json.loads(res.read())
        tabella = []
        for i in data:
            list = []
            list.append(i["nome"])
            list.append(i["data"])
            tabella.append(list)
        self.conn.close()
        return tabella
       

Fino a qua nulla di nuovo.