Ever wondered if you could use PowerShell Core to script GUI controls on Linux ?
Well if you miss the Out-Gridview and more GUI controls (Widgets)
See below on how to simulated this in your Powershell scripts
PS : There is an Out-GridView Module for PS Core on Linux.
https://www.powershellgallery.com/packages/Microsoft.PowerShell.GraphicalTools/0.2.0
But unfortunately it runs only on an x64 bit OS
To solve the errors in WSL2 :
Error libGL error: No matching fbConfigs or visuals found can be fixed with
Run this command :
export LIBGL_ALWAYS_INDIRECT=1
There is also a commandline option, for Out-GrdiView
But to get going with GTK widgets (Gui Controls) using PowerShell Scritping…
See below
SOLUTION :
1. Make sure your ave installed PowerShell Core on your RPI
See here for PS Core 7.2
2. Make sure you have installed Zenity on you RPI
It should be installed out of the box in Raspbian
Run this command to check it.
zenity --version
if not installed run this command
sudo apt-get install -y zenity
3. Run the Zenity commands to interact with PowerShell Core
Checkbox Example :
You can use the return options from the checkbox to use in your PowerShell script logic
This goes for all the GUI Controls !
….
4. Zenity PowerShell Module
To make life easy I created a PS Module to get most commands and options easy accessible.
Later I might decide to make it available on GitHub …
Module includes all relevant Widgets
Special treat is the Out-GridView
(for the PowerShell users that are missing the 32bit version of Out-GridView)
Also see here for a dynamically returning an SQLite database in a LIST Gui
PS :
This has not yet been tested on the Bullseye – the new version of Raspberry Pi OS using GTK3
See here for more info.
If someone can confirm that all is worling well, that would be great
Tips and Tricks :
If you want to run Zentiy Widgets on your Windows WSL. you will need a few more components
See here
If you want to know more about Developing GUI Apps using .NET Core Cross Platform …
See here
Enjoy !!