diff --git a/pytket/docs/changelog.rst b/pytket/docs/changelog.rst index 66e1482c38..b49720e1b1 100644 --- a/pytket/docs/changelog.rst +++ b/pytket/docs/changelog.rst @@ -5,6 +5,7 @@ Changelog ------------------- * Support Python 3.13. +* Fix small default display screen for circuit renderer. 1.33.1 (October 2024) --------------------- diff --git a/pytket/docs/display.md b/pytket/docs/display.md index e74f075494..2a4092c240 100644 --- a/pytket/docs/display.md +++ b/pytket/docs/display.md @@ -29,11 +29,12 @@ from pytket.circuit.display import get_circuit_renderer circuit_renderer = get_circuit_renderer() # Instantiate a circuit renderer circuit_renderer.set_render_options(zx_style=True) # Configure render options -circuit_renderer.condense_c_bits = False # You can also set the properties on the instance directly +circuit_renderer.config.render_options.condense_c_bits = False # You can also set the properties on the instance directly +circuit_renderer.config.min_height = "300px" # Change the display height print("Render options:") print(circuit_renderer.get_render_options()) # View currently set render options -circuit_renderer.min_height = "300px" # Change the display height +circuit_renderer.save_render_options() # Export current render options to the pytket config circ = Circuit(2,2) # Define Circuit circ.H(0).H(1).CX(0, 1).Rz(0.4, 1).CX(0, 1).H(0).H(1).measure_all() diff --git a/pytket/pytket/circuit/display/__init__.py b/pytket/pytket/circuit/display/__init__.py index 0841b5324a..38483197c0 100644 --- a/pytket/pytket/circuit/display/__init__.py +++ b/pytket/pytket/circuit/display/__init__.py @@ -127,9 +127,11 @@ class CircuitDisplayConfig(PytketExtConfig): @classmethod def from_extension_dict(cls, ext_dict: dict[str, Any]) -> "CircuitDisplayConfig": + min_h = ext_dict.get("min_height") + min_w = ext_dict.get("min_width") return CircuitDisplayConfig( - min_height=str(ext_dict.get("min_height")), - min_width=str(ext_dict.get("min_width")), + min_height=str(min_h) if min_h is not None else "400px", + min_width=str(min_w) if min_w is not None else "500px", orient=ext_dict.get("orient"), render_options=RenderOptions( **(ext_dict["render_options"] if "render_options" in ext_dict else {})