You are creating a button every frame. You should only create it once.
You should also call the window.clear function (you should uncomment it). In sfml you must redraw every frame entirely.
The code should look more like this:
#include <SFML/Audio.hpp>
#include <TGUI/TGUI.hpp>
#include <conio.h>
int main()
{
// Create the window
sf::RenderWindow window(sf::VideoMode(800, 600), "Window");
tgui::Gui gui(window);
// Load the font (you should check the return value to make sure that it is loaded)
gui.setGlobalFont("TGUI/fonts/DejaVuSans.ttf");
tgui::Button::Ptr button(gui);
button->load("TGUI/widgets/Black.conf");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
// Pass the event to all the widgets (if there would be widgets)
gui.handleEvent(event);
}
window.clear();
// Draw all created widgets
gui.draw();
window.display();
}
return EXIT_SUCCESS;
}
What errors are you getting in the command prompt?
To create a list box, just do like you would create a button:
tgui::ListBox::Ptr listBox(gui);
listBox->load("TGUI/widgets/Black.conf");
And then use setSize to give it the correct size, addItem function to add items to it, ...
Here is the list of other function you can call on the listbox:
https://tgui.eu/dcmtn/v0.6/classtgui_1_1ListBox.html.