Differenze tra le versioni di "Ottenere informazioni sul tempo meteorologico di una città mediante il sito web wttr.in"
Da Gambas-it.org - Wikipedia.
(2 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" | + | 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 TextLabel | Private tl As TextLabel | ||
Riga 13: | Riga 13: | ||
.W = Screen.AvailableWidth | .W = Screen.AvailableWidth | ||
.H = Screen.AvailableHeight | .H = Screen.AvailableHeight | ||
+ | .Title = "ATTENDERE......" | ||
End With | End With | ||
Riga 28: | Riga 29: | ||
− | Public Sub | + | Public Sub Webv_Finish() |
− | tl.Text = wv. | + | tl.Text = wv.GetHtml() |
+ | Me.Title = "<FONT Color=gray>Roma</font>" | ||
End | End |
Versione attuale delle 17:52, 31 mag 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 .Title = "ATTENDERE......" 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() Me.Title = "Roma" 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