Python Forum
Getting Python error: AttributeError: 'tuple' object has no attribute 'Text'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Python error: AttributeError: 'tuple' object has no attribute 'Text'
#1
Hello guys,
I have a simple challenge for you.

I'm the author of a tool called Virtual Forms. It is an ActiveX server control.
For now, we have only used it from VBA, VB.NET & C#
Now my colleagues asked me if we could use it from Python on windows.
It works, but, because I'm also not a Python expert I got stuck on one line of code.

Here is the code that works:
import win32com.client as win32

vf1 = win32.gencache.EnsureDispatch('VirtualForm2.VirtualForm')

vf1.VFFile = r"C:\Users\WinPIS\Desktop\VFPython\VFFilePython.vf"

vf1.DatabaseType = 2

vf1.ConnectionString = r"DRIVER={MySQL ODBC 5.3 Unicode Driver};" \
                       "Port=3306;" \
                       "SERVER=myserver;" \
                       "DATABASE=mydb;" \
                       "USER=myusr;" \
                       "PASSWORD=mypass;" \
                       "OPTION=3;"

#vf1.OpenVirtualFormDesigner()

vf1.ShowVirtualForm("VF2")
As we can see, we can call methods and pass some parameters to this control.
The control accepts the VFFile, DatabaseType and the ConnectionString parameter, because when we run the line with code:

vf1.ShowVirtualForm("VF2")
it opens the Virtual Form, connect to the MySQL database and displays the data. Here is the screenshot:

[Image: VirtualForm2_2018-07-26_16-14-49.png]

Then, for example, in VBA I use this line of code to change the text that is in a textbox:

vf1.TextBox("VF2", "[customerid]").Text = "888"
And here is the screenshot that it works in VBA:

[Image: VirtualForm2_2018-07-26_16-30-00.png]

But when I try it from Python I got this error:

Error:
Traceback (most recent call last): File "C:/Users/WinPIS/PycharmProjects/VFPython/VFPythonFile.py", line 20, in <module> vf1.TextBox("VF2", "[customerid]").Text = "888" AttributeError: 'tuple' object has no attribute 'Text'
This only works in windows.
If you want to try it out you will need to install the setup for this Virtual Forms control that is in this download:
https://www.virtual-forms.com/sharing/Vi...0.0.31.zip

And here is the VFFile:
https://www.virtual-forms.com/sharing/VFFilePython.vf

Any suggestion is welcome.
Thanks,
Davor
Reply


Messages In This Thread
Getting Python error: AttributeError: 'tuple' object has no attribute 'Text' - by dageci - Jul-26-2018, 08:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error: audioio has no attribute 'AudioOut' netwrok 3 712 Oct-22-2023, 05:53 PM
Last Post: netwrok
  getpass.getpass() results in AttributeError: module 'os' has no attribute 'O_NOCTTY' EarthAndMoon 4 850 Oct-03-2023, 02:00 PM
Last Post: deanhystad
  AttributeError: '_tkinter.tkapp' object has no attribute 'username' Konstantin23 4 1,883 Aug-04-2023, 12:41 PM
Last Post: Konstantin23
  Need help with 'str' object is not callable error. Fare 4 905 Jul-23-2023, 02:25 PM
Last Post: Fare
  Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att Melcu54 9 1,642 Jun-28-2023, 11:13 AM
Last Post: Melcu54
  Parallel processing - AttributeError: Can't get attribute 'sktimekmeans' Mohana1983 1 810 Jun-22-2023, 02:33 AM
Last Post: woooee
  Python: AttributeError: 'PageObject' object has no attribute 'extract_images' Melcu54 2 4,137 Jun-18-2023, 07:47 PM
Last Post: Melcu54
  Object attribute behavior different in 2 scripts db042190 1 807 Jun-14-2023, 12:37 PM
Last Post: deanhystad
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,533 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 5,922 Feb-17-2023, 06:01 PM
Last Post: Sameer33

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020