Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Created June 21, 2019 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awesomebytes/b928ec05ed22aca34bb19e9ac25089cf to your computer and use it in GitHub Desktop.
Save awesomebytes/b928ec05ed22aca34bb19e9ac25089cf to your computer and use it in GitHub Desktop.
POC of loading an image into a Svg canvas in REMI
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import remi.gui as gui
from remi import start, App
import os
class MyApp(App):
def main(self):
# creating a container VBox type, vertical (you can use also HBox or Widget)
main_container = gui.VBox(width=350, height=350,
style={'margin': '0px auto'})
svg = gui.Svg(300, 300, style={'border': '1px solid black'})
main_container.append(svg)
svg_image = gui.SvgImage(gui.load_resource("./image.jpg"), 2, 2, 296, 296)
svg.append(svg_image)
# returning the root widget
return main_container
if __name__ == "__main__":
# starts the webserver
start(MyApp, address='0.0.0.0', port=0,
start_browser=True, username=None, password=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment