Python 3 WxPython RGB Hexadecimal Colorpicker Dialog or Modal Tutorial to Get Selected Color Value GUI Desktop App Full Project For Beginners

Python 3 WxPython RGB Hexadecimal Colorpicker Dialog or Modal Tutorial to Get Selected Color Value GUI Desktop App Full Project For Beginners

 

Welcome folks today in this blog post we will be displaying a color picker dialog in wxpython using python. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the below library using the pip command as shown below

 

pip install wxpython

 

After installing this library you need to make an app.py file and copy paste the following code

 

app.py

 

import wx

if __name__ == "__main__":
    app = wx.PySimpleApp()
    dialog = wx.ColourDialog(None)
    dialog.GetColourData().SetChooseFull(True)
    if dialog.ShowModal() == wx.ID_OK:
        data = dialog.GetColourData()
        print('You selected: %s\n' % str(data.GetColour().Get()))
    dialog.Destroy()

 

 

See also  Python 3 Radio Button Widget Example in GUI Desktop App Full Project For Beginners

If you execute the above python script by typing the below command

 

python app.py

 

 

 

Leave a Reply