Python Forum
Python if statement docx wount work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python if statement docx wount work
#1
Hi,

I cant get this code to work, I just want a button to be pressed, calling definition "helloCallBack" and from it a series of
if statements, whereas, if a variable is a string then write that string to the document..

It just woun't work, what am I doing wrong?

def helloCallBack():

   if tkvar == 'Broker':
      document = Document()
      document.add_heading("Broker")
      document.save('agreement034.docx')
Kr.
Selfiatus1

...and yes I do have installed docx and tkinter modules.

It woun't write text to the document, can anyone help please?
Reply


Messages In This Thread
Python if statement docx wount work - by Selfiatus1 - Jun-07-2019, 03:54 PM
RE: Python if statement docx wount work - by woooee - Jun-07-2019, 05:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  no module named 'docx' when importing docx MaartenRo 1 895 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Replace a text/word in docx file using Python Devan 4 3,478 Oct-17-2023, 06:03 PM
Last Post: Devan
  python-docx: preserve formatting when printing lines Tmagpy 4 2,116 Jul-09-2022, 01:15 AM
Last Post: Tmagpy
  python-docx- change lowercase to bold, italic Tmagpy 0 1,420 Jul-01-2022, 07:25 AM
Last Post: Tmagpy
  python-docx regex : Browse the found words in turn from top to bottom Tmagpy 0 1,540 Jun-27-2022, 08:45 AM
Last Post: Tmagpy
  python-docx regex: replace any word in docx text Tmagpy 4 2,253 Jun-18-2022, 09:12 AM
Last Post: Tmagpy
  getting an import statement to work in my program barryjo 1 1,672 Dec-06-2021, 04:28 PM
Last Post: snippsat
  Сombine (Merge) word documents using python-docx Lancellot 1 11,578 May-12-2021, 11:07 AM
Last Post: toothedsword
  How to add run in paragraph using python-docx? toothedsword 0 2,797 May-12-2021, 10:55 AM
Last Post: toothedsword
  Why doesn't this print statement work? stylingpat 10 5,780 Mar-23-2021, 07:54 PM
Last Post: buran

Forum Jump:

User Panel Messages

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