Jump to content

BennieC

Members
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. BennieC

    Listview Programming

    I have now used frames and a vertscrollbox and indeed it works well. (Even struggled through the French way of doing it) I would like to use a flow layout and have inserted that into the scrollbox. This seems to work better than me calculating object position as I would have to do in the scrollbox. I do however have a problem with the flowlayout when anchored to the right of the scrollbox and have posted a separate question on that.
  2. BennieC

    TFlowLayout in TVertScrollbox

    I want to use the flowlayout (In a vertscrollbox) where the width can be varied when application changes size. The number of items will overflow to the bottom, hence the scrollbox. When using a flowlayout on its own (anchored to the right of the form), stretching the width results in a proper re-layout. However if it is in a scroll box (anchored to the right) it seems to miscalculate the width and allows objects to overflow to the right, but only when I anchor the flowlayout to the right of the scrollbox. If it is not anchored to the scrollbox it works correctly but of course does not stretch with the form. Does anyone have any ideas?
  3. BennieC

    Listview Programming

    Indeed, the list items will be created during run time. We have no dataset.
  4. BennieC

    Listview Programming

    Good day I am trying to build an application which requires me to display multiple images in groups with selectable sizes. The images consist of a bitmap and a text field. My idea is to put the image groups in a TListview (Which I hope can display horizontally) and then add these listview groups into a TFlowlayout to manage the screen layout. However, I simply do not get it right to create a TListview item programmatically to display the image. I have tried to create a TListItemImage as well as simply adding a TListViewItem but neither worked in that I could see anything on the screen. I am including my test code (Note it pulls images from a folder for testing). The commented out sections will probably indicate some of the experiments that I tried. I will probably also struggle to add the TListviews to the TFlowlayout. Some advice will be much appreciated. The idea is that the application will run on both Android mobile as well as desktops. prjFlowLO.dpr prjFlowLO.dproj uFlowLOMain.fmx uFlowLOMain.pas
  5. BennieC

    Returning lists from Python to Delphi

    @pyscripter I have used your structure but still Delphi insist on giving me strings instead of floating point values. Can I somehow force the variant conversion to take this as a float? I have tried to assign the variant to single variable but have no luck. Regards I have tried assigning the variant to a single but get no joy. What does work is if I convert it to a single. var ConfValue:variant := aRectItm.GetItem(classCnt); ConfSingle := strtofloat(ConfValue);
  6. BennieC

    Returning lists from Python to Delphi

    @pyscripter I have used your structure but still Delphi insist on giving me strings instead of floating point values. Can I somehow force the variant conversion to take this as a float? I have tried to assign the variant to single variable but have no luck. Regards
  7. BennieC

    Returning lists from Python to Delphi

    @pyscripter Thank you. Indeed the layerOutputs is a variant and I am using VarPyth. However, using your syntax I seem to have made progress. Could you please explain the syntax as I am not familiar with that. Also, how do I declare a variable in a loop using the inline var statement? Kind regards
  8. BennieC

    Returning lists from Python to Delphi

    @SwiftExpat Thanks for the response. Regarding the bottleneck , the processing is requires the parsing of 507 + 2028 (and possibly an additional 8000) items, each consisting of 41 values (Yolo output) This has to happen in less than 10ms in order to stay within real time, or as close to that as possible. Regarding the code - my current attempt looks as follows (It does get the correct values out but takes about 500ms) aRectItmStr := aRectList.GetItem(rectCnt); // Get a rect , should have 41 values // It looks like this is a single string // Remove unnecessary spaces, linefeeds and brackets // Some records have long spaces while containstext(aRectItmStr, ' ') do aRectItmStr := StringReplace(aRectItmStr, ' ', ' ', [rfReplaceAll]); // Repeat until only single spaces exist aRectItmStr := StringReplace(aRectItmStr, '[', '', [rfReplaceAll]); aRectItmStr := StringReplace(aRectItmStr, ']', '', [rfReplaceAll]); aRectItmStr := StringReplace(aRectItmStr, #$A, '', [rfReplaceAll]); // #=numerical code, $=Hexdecimal aListArray := aRectItmStr.Split([' ', '''']); for i := 0 to MIN(length(aListArray), 41)-1 do aRectItmVals := strtofloatdef(aListArray, 0.0); I know this is probably inefficient but it would help a lot if i can just read the items as a n array of float values. Kind regards
  9. BennieC

    Returning lists from Python to Delphi

    Thank you for this - it does seem to be the right way to go as my current string parsing is far too slow. However I have no idea how to use either of the two options. In the Buffer protocol, how do I return my result which seems to be a list of arrays. at present the return value is just the tuple which in Python looks like this: Name: layerOutputs Type: tuple Value: (array([[0.09, 0.03, 0.34...0.]]. dtype=float32), array([[0.06, 0.05, 0.67...0.]]. dtype=float32)) Currently this is just returned as a value with name layerOutputs, but Delphi sees this as a character string In the MemShare solution - how do I determine the memory position in Python and how do I determine the memory structure to use the binary representation. Are there any resources you can point me to as I am at a complete loss/
  10. Hi, I have a Delphi application that calls OpenCV via Python4Delphi. It returns a tuple of floating point values in Python. However when I return the tuple to Delphi I get a string variable. Is there a way to force the conversion to maintain the floating point values. I managed to parse the string list in Delphi into a floating point array but the application should be in real time so this is an unnecessary step. In Python In Delphi Regards
  11. BennieC

    Converting tuples into Delphi objects

    Apologies I solved the problem - just me being stupid. I misunderstood the GetItem method. All seems to be working now.
  12. BennieC

    Converting tuples into Delphi objects

    Thank you very much. The problem is that there are different arrays in the tuple and unless I can separate them I don't know how to convert the variants into Delphi variables. The lengths are not always as short as the sample and can indeed be very long. I was hoping to use something like aTmpvariant1 := myPlatTuple[0] aTmpvariant2 := myPlatTuple[1] etc, and then be able to individually decode these like aDelphiVal1 := aTmpvariant1[0], etc. but that does not work.
  13. I am struggling with getting my results into Delphi. I have used direct access to the Python function as shown in the screencopy and in fact receive the correct results in Delphi using Code insight as shown. But I have no success in actually accessing this tuple from Delphi There are three items in the tuple (which is declared as a variant), the first containing a list of arrays, the second an array and the third a list of values. How do I individually access these values in Delphi - some sample code will help as I can't find anything in the demos and my knowledge of variants is quite inadequate. Kind regards
  14. BennieC

    Returning lists from Python to Delphi

    I am still struggling with getting my results into Delphi. I have used direct access to the Python function as shown in the screencopy and in fact receive the correct results in Delphi using Code insight as shown. But I have no success in actually accessing this tuple from Delphi There are three items in the tuple, the first containing a list of arrays, the second an array and the third a list of values. How do I individually access these values - some sample code will help as I can't find anything in the demos and my knowledge of variants still seem to be inadequate. Kind regards
  15. BennieC

    Returning lists from Python to Delphi

    I have found the offending code in PythonEngine - function PyObjectAsVariant In line 5390 there is an ExtractDate(Result) line. Following thorugh it goes to the ExtractDate function with an unassigned value for date, but expecting to decode obj which is nil at this point - hence the error. This is nil because Getvar in GetVarAsVariant returned a nil for obj. Now clearly my Python object has a value as it returns it as strings in the VarPyIterate function. Can this help to explain my problem? Regards
×