Differenze tra le versioni di "Ottenere informazioni sul tempo meteorologico di una città mediante il sito web wttr.in"

Da Gambas-it.org - Wikipedia.
(Creata pagina con "Il sito web "https://wttr.in/Roma" consente di conoscere il tempo meteorologico di una città. In Gambas potrà essere consultato con almeno due soluzioni. Il seguente codic...")
 
(3 versioni intermedie di uno stesso utente non sono mostrate)
Riga 3: Riga 3:
 
In Gambas potrà essere consultato con almeno due soluzioni.
 
In Gambas potrà essere consultato con almeno due soluzioni.
  
Il seguente codice si basa sul Componente "gb.qt5" (o "gb.gui.qt") di Gambas, ed è necessario attivare anche il Componente "gb.qt5.webkit" (o "gb.gui.qt.webkit").  
+
Il seguente codice si basa sul Componente "gb.qt5" di Gambas, ed è necessario attivare anche il Componente "gb.qt5.webview".
 
  Private wv As New WebView(Me) As "Webv"
 
  Private wv As New WebView(Me) As "Webv"
  Private tl As New TextLabel(Me)
+
  Private tl As TextLabel
 
   
 
   
 
   
 
   
Riga 13: Riga 13:
 
     .W = Screen.AvailableWidth
 
     .W = Screen.AvailableWidth
 
     .H = Screen.AvailableHeight
 
     .H = Screen.AvailableHeight
     .Arrangement = Arrange.Fill
+
  End With
 +
 +
  With tl = New TextLabel(Me)
 +
    .X = 0
 +
    .Y = 0
 +
    .W = Me.W
 +
    .H = Me.H
 +
     .Background = Color.DarkGreen
 
   End With
 
   End With
 
   
 
   
Riga 21: Riga 28:
 
   
 
   
 
   
 
   
  Public Sub Webv_Load()
+
  Public Sub Webv_Finish()
 
   
 
   
   tl.Text = wv.HTML
+
   tl.Text = wv.GetHtml()
 
   
 
   
 
  End
 
  End
Riga 31: Riga 38:
 
   Dim hc As New HttpClient
 
   Dim hc As New HttpClient
 
   
 
   
   Print hc.Download("https&#058;//wttr.in/<FONT Color=gray>Roma</font>", Null)
+
   Print "\e[1m\e[31m"; hc.Download("https&#058;//wttr.in/<FONT Color=gray>Roma</font>", Null)
 
   
 
   
 
  End
 
  End

Versione delle 12:20, 9 feb 2024

Il sito web "https://wttr.in/Roma" consente di conoscere il tempo meteorologico di una città.

In Gambas potrà essere consultato con almeno due soluzioni.

Il seguente codice si basa sul Componente "gb.qt5" di Gambas, ed è necessario attivare anche il Componente "gb.qt5.webview".

Private wv As New WebView(Me) As "Webv"
Private tl As TextLabel


Public Sub Form_Open()

 With Me
   .W = Screen.AvailableWidth
   .H = Screen.AvailableHeight
 End With

 With tl = New TextLabel(Me)
   .X = 0
   .Y = 0
   .W = Me.W
   .H = Me.H
   .Background = Color.DarkGreen
 End With

 wv.Url = "https://wttr.in/Roma"

End


Public Sub Webv_Finish()

 tl.Text = wv.GetHtml()

End

In quest'altro esempio, invece, si dovranno attivare i Componenti "gb.net" e "gb.net.curl":

Public Sub Main()
 
 Dim hc As New HttpClient

 Print "\e[1m\e[31m"; hc.Download("https://wttr.in/Roma", Null)

End