git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Assign Excel cell value from Datepicker widget Selection using Python


On 5/07/20 5:20 AM, narenchunduri at gmail.com wrote:
> I am trying to assign a widget to an excel cell. Convertion wont help me.Thanks


That's true - and false!

Unfortunately, these posts have revealed little about you and your level 
of understanding of Python specifically, and computer programming more 
generally. This lack of information creates an impression that you are 
not used to working within a professional team. The example could easily 
be a professional task, or a student assignment. In the latter case, we 
will be happy to help you learn, but are not keen to 'do your homework'. 
(also, please be advised that there is a separate Python-Tutor 
Discussion List)

To solve this problem requires an understanding of Python and how it 
works, plus ipy/Jupiter and their widgets, and Excel as seen through the 
openpyxl library. It is not a trivial task!


To the problem:-

First, we must understand how ipy.widgets work 
(https://minrk-ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html). 
A widget is not like Python's basic input() which displays a "prompt" 
and collects a (str) value for return across an assignment statement, eg

     amount = input( "How much? " )

A widget is an instantiated class, and as such we must consider its 
"attributes" and "methods" - which has the pre-requisite of 
understanding how Python works with "objects".

The web.ref describes the value property. So, if the DatePicker()'s 
result is assigned to an intermediate variable, that could be 
printed-out, together with its type(). This will provide valuable 
information.

Then, assign the value property of that variable (which is actually an 
object; that class instantiated) to another intermediate variable - 
let's call that returned_date, and print its value and type.

Finally, we should be able to reconcile the above data-items with the 
workbook's format/type demands, so that the date can be assigned to the 
B2 cell...


Let us know how you get on (copy-paste any relevant code and errors into 
your email message, if relevant)...
-- 
Regards =dn