Python Forum
if line edit is empty put in a string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
if line edit is empty put in a string
#1
I am trying to see if a line edit is empty, and if so, put the word Other in it.  What I have so far crashes

        if len(self.ui.carlabel) == 0:
            self.ui.carlabel.setText(str('Other'))
by the way, "carlabel" is a line edit, not a label
thanks
Reply


Messages In This Thread
if line edit is empty put in a string - by birdieman - Mar-15-2017, 11:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  File "<string>", line 19, in <module> error is related to what? Frankduc 9 12,676 Mar-09-2023, 07:22 AM
Last Post: LocklearSusan
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,415 Sep-27-2022, 01:38 PM
Last Post: buran
  -i option changes sys.path (removes leading empty string '') markanth 6 2,031 Aug-26-2022, 09:27 PM
Last Post: markanth
  Inserting line feeds and comments into a beautifulsoup string arbiel 1 1,214 Jul-20-2022, 09:05 AM
Last Post: arbiel
  append a string to a modified line Mr_Blue 10 3,931 Sep-16-2021, 07:24 PM
Last Post: Mr_Blue
  How to capture string from a line to certain line jerald 1 1,937 Jun-30-2021, 05:13 PM
Last Post: Larz60+
  Why is my string empty? karabakh 5 2,439 Jan-30-2021, 04:51 AM
Last Post: karabakh
  How to create new line '/n' at each delimiter in a string? MikeAW2010 3 2,887 Dec-15-2020, 05:21 PM
Last Post: snippsat
  How to print string multiple times on new line ace19887 7 5,827 Sep-30-2020, 02:53 PM
Last Post: buran
  Add new line after finding last string in a region Nigel11 1 1,913 Aug-08-2020, 10:00 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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