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

Da Gambas-it.org - Wikipedia.
Riga 38: 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 08:58, 24 set 2023

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" (o "gb.gui.qt") di Gambas, ed è necessario attivare anche il Componente "gb.qt5.webkit" (o "gb.gui.qt.webkit").

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_Load()

 tl.Text = wv.HTML

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