Code Monkey home page Code Monkey logo

Comments (6)

atticus-lv avatar atticus-lv commented on June 20, 2024

the main.py file is insdie single_page_app. actually I use an absolute path/web image will also have this problem. I will upload a screenshot later

from nicegui.

atticus-lv avatar atticus-lv commented on June 20, 2024

yes, check this video @python-and-fiction

2024-06-15.16-08-10.mp4
    @router.add('/')
    def show_one():
        ui.image('https://github.com/zauberzeug/nicegui/blob/main/website/static/logo_square.png?raw=true')

    @router.add('/two')
    def show_two():
# my local path
        ui.image(r'C:\Users\atticus\Desktop\ToDoList-nicegui\single_page_app\logo_square.png')

    @router.add('/three')
    def show_three():
# your solution
        ui.image('single_page_app/logo_square.png')

from nicegui.

atticus-lv avatar atticus-lv commented on June 20, 2024

@falkoschindler hi falkoschindler, do you have any idea on this problem?

from nicegui.

python-and-fiction avatar python-and-fiction commented on June 20, 2024

same as #2011
Follow this
#2035 (comment)

from nicegui.

atticus-lv avatar atticus-lv commented on June 20, 2024

add statics file seem not work for me, but adding all reroute with ui.page works

from nicegui.

falkoschindler avatar falkoschindler commented on June 20, 2024

Hi @atticus-lv,

This is very confusing, but I think I understand what is happening:
The @ui.page('/{_:path}') decorator creates an endpoint that matches all routes including static images paths. But since the router can't serve images, the image isn't displayed.

As a workaround, you can limit the route to non-path strings (i.e. strings not containing a slash /): @ui.page('/{_}').

I'll close this issue, because it isn't really a bug but a limitation of our small "single page app" example.
A much more powerful API is in the making: PR #2811.

from nicegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.