LCD flickers for part of code but not all

So I am working on a project so that when nothing is pressed, the 16x2 lcd screen will display “press the button” and when you press it it will display “hello world” for 5 seconds and then return to the “press the button”. When I start up the arduino, it displays “press the button” but it doesn’t fully load and will look like it is trying to display it but just flickers. When I press the button, the hello world statement appears perfectly correct but then it will go back to the flickering of “press the button” after 5 seconds. I am pretty sure my wire setup is correct because it displays hello world fine.

Any ideas of why the “press the button” flickers so bad?

#include <LiquidCrystal.h>

const int but1 = 3;  
const int but2 = 4;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);  
int buttonState = 0;
int buttonState1 = 0;

void setup() {  
  lcd.begin(16, 2);
  pinMode(but1, INPUT);
  pinMode(but2, INPUT);


void loop() {  
  buttonState = digitalRead(but1);
    if (buttonState == LOW)
      lcd.print("Press the button");
      if (buttonState == HIGH)
    lcd.setCursor(0, 0);
    lcd.setCursor(0, 1);

It's constantly clearing and showing 'Press the button' as fast as it can when your button is low, as written.

What I would do is just add the "Press a button" part once in setup(), and then once again after your 5 sec delay. Delete the 'if button is low' part.

So pressing a button will show "Hello World" for 5 seconds, then print "Press a button" just once until a button is pressed again.

You may also want to show us how your button is wired, because I have a feeling your button may be improperly resistored. And while fine for the current prog, you can look forward to button debouncing as you advance to new projects.

Look for a CHANGE in the button, not the current state of the button. Then most of the time the loop does nothing but check if the state changed.