Python Forum
Pyodbc does not accept variable from tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyodbc does not accept variable from tkinter
#3
Sure, sorry, totally beginner. I've got the OptionMenu:
s = StringVar()
s.set('a')
om = OptionMenu(master, s, 'Server1', 'Server2', 'Server3', 'd')
om.pack()
def changed(*args):
    s.get()
    print(changed)
[python]
[/python]

I'd like ON CHANGE to pass the value to the pyodbc connection:

Datab="Server1;"
print(Datab)

cnxn = pyodbc.connect("Driver={SQL Server Native Client 11.0};"
                      +str(Datab)+
                      "Database=master;"
                      "Trusted_Connection=yes;")
instead to use Datab as variable I'd like to use changed (from option) and to refresh the mask after changing the value in the option menu.

I hope I'been able to explain my request.
Thanks
Reply


Messages In This Thread
RE: Pyodbc does not accept variable from tkinter - by diegoctn - Feb-08-2019, 05:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using pyodbc&pandas to load a Table data to df tester_V 3 746 Sep-09-2023, 08:55 PM
Last Post: tester_V
  accept command line argument mg24 5 1,239 Sep-27-2022, 05:58 PM
Last Post: snippsat
  pyodbc gmerritt 8 2,798 Feb-21-2022, 07:21 PM
Last Post: gmerritt
  Formatting Data/Time with Pyodbc and openpyxl bearcats6001 0 2,251 Aug-17-2020, 03:44 PM
Last Post: bearcats6001
  Get database used data space from pyodbc susja 1 2,201 Aug-14-2020, 02:01 PM
Last Post: susja
  I need my compiled Python Mac app to accept a file as a parameter Oethen 2 2,357 May-10-2020, 05:57 PM
Last Post: Oethen
  pyodbc error ('82', '[82] 523 80 (0) (SQLDriverConnect)') paulsuk1982 1 2,133 Nov-29-2019, 11:05 AM
Last Post: Larz60+
  pyodbc.Error SQLBindParameter pcarra 0 3,841 Jul-08-2019, 08:22 PM
Last Post: pcarra
  Pyodbc error taxit 1 5,139 Jun-18-2019, 01:13 AM
Last Post: Larz60+
  Using VBA to Call a Python script causes error in pyodbc connector pcarra 1 2,775 Jun-11-2019, 04:14 PM
Last Post: pcarra

Forum Jump:

User Panel Messages

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