Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Small fixes to gtk3 examples.#10679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
anntzer wants to merge1 commit intomatplotlib:masterfromanntzer:gtk3examples
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,14 +6,14 @@
Demonstrate NavigationToolbar with GTK3 accessed via pygobject.
"""

from gi.repository import Gtk

from matplotlib.backends.backend_gtk3 import (
NavigationToolbar2GTK3 as NavigationToolbar)
from matplotlib.backends.backend_gtk3agg import (
FigureCanvasGTK3Agg as FigureCanvas)
from matplotlib.figure import Figure
import numpy as np
from gi.repository import Gtk


win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
Expand All@@ -29,11 +29,11 @@
vbox = Gtk.VBox()
win.add(vbox)

# Add canvas to vbox
# Add canvas to vbox.
canvas = FigureCanvas(f) # a Gtk.DrawingArea
vbox.pack_start(canvas, True, True, 0)

# Create toolbar
# Create toolbar.
toolbar = NavigationToolbar(canvas, win)
vbox.pack_start(toolbar, False, False, 0)

Expand Down
6 changes: 3 additions & 3 deletionsexamples/user_interfaces/embedding_in_gtk3_sgskip.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,12 +7,12 @@
GTK3 accessed via pygobject.
"""

from gi.repository import Gtk

from matplotlib.backends.backend_gtk3agg import (
FigureCanvasGTK3Agg as FigureCanvas)
from matplotlib.figure import Figure
import numpy as np
from gi.repository import Gtk


win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
Expand All@@ -27,7 +27,7 @@

sw = Gtk.ScrolledWindow()
win.add(sw)
# A scrolled window border goes outside the scrollbars and viewport
# A scrolled window border goes outside the scrollbars and viewport.
sw.set_border_width(10)

canvas = FigureCanvas(f) # a Gtk.DrawingArea
Expand Down
11 changes: 7 additions & 4 deletionsexamples/user_interfaces/mpl_with_glade_316_sgskip.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,13 +5,14 @@

"""

fromgi.repository importGtk
frompathlib importPath

from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from matplotlib.backends.backend_gtk3agg import (
FigureCanvasGTK3Agg as FigureCanvas)
import numpy as np
from gi.repository import Gtk


class Window1Signals(object):
Expand All@@ -21,12 +22,14 @@ def on_window1_destroy(self, widget):

def main():
builder = Gtk.Builder()
builder.add_objects_from_file("mpl_with_glade_316.glade", ("window1", ""))
builder.add_objects_from_file(
str(Path(__file__).with_name("mpl_with_glade_316.glade")),
("window1", ""))
builder.connect_signals(Window1Signals())
window = builder.get_object("window1")
sw = builder.get_object("scrolledwindow1")

# Start of Matplotlib specific code
# Start of Matplotlib specific code.
figure = Figure(figsize=(8, 6), dpi=71)
axis = figure.add_subplot(111)
t = np.arange(0.0, 3.0, 0.01)
Expand All@@ -39,7 +42,7 @@ def main():
canvas = FigureCanvas(figure) # a Gtk.DrawingArea
canvas.set_size_request(800, 600)
sw.add_with_viewport(canvas)
# End of Matplotlib specific code
# End of Matplotlib specific code.

window.show_all()
Gtk.main()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp